github.com/chrislusf/greenpack@v3.7.1-0.20170911073826-ad5bd10b7c47+incompatible/testdata/my.go (about)

     1  package testdata
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  //go:generate greenpack
     8  //go:generate greenpack -o my_msgp_gen.go -method-prefix=MSGP -io=false -tests=false
     9  
    10  const greenSchemaId64 = 0x6eb25cc0f9a3e
    11  
    12  //func main() {}
    13  
    14  type S struct{}
    15  
    16  type S2 struct {
    17  	A struct{}         `zid:"0" msg:"alpha"`
    18  	B string           `msg:"beta" zid:"1"`
    19  	R map[string]uint8 `zid:"2" msg:"ralph"`
    20  	P uint16           `zid:"3" msg:",deprecated"`
    21  	Q uint32           `zid:"4"`
    22  	T int64            `zid:"5" msg:",showzero"`
    23  
    24  	// test const array and *ast.SelectorExpr as array size
    25  	Arr [6]float64 `zid:"6" msg:"arr"`
    26  
    27  	MyTree *Tree `zid:"7"`
    28  }
    29  
    30  type Tree struct {
    31  	Chld []Tree `zid:"0"`
    32  	Str  string `zid:"1"`
    33  	Par  *S2    `zid:"2"`
    34  }
    35  
    36  type Big struct {
    37  	Slice     []S2        `zid:"0"  msg:",showzero"`
    38  	Transform map[int]*S2 `zid:"1"  msg:",showzero"`
    39  	Myptr     *S2         `zid:"2"  msg:",showzero"`
    40  	Myarray   [3]string   `zid:"3"  msg:",showzero"`
    41  	MySlice   []string    `zid:"4"  msg:",showzero"`
    42  }
    43  
    44  type A struct {
    45  	Name   string    `zid:"0" msg:"name"`
    46  	Bday   time.Time `zid:"1"`
    47  	Phone  string    `zid:"2" msg:"phone,omitempty"`
    48  	Sibs   int       `zid:"3" msg:",omitempty"`
    49  	GPA    float64   `zid:"4"`
    50  	Friend bool      `zid:"5"`
    51  }
    52  
    53  type Sys struct {
    54  	F interface{} `zid:"0"`
    55  }