github.com/benma/gogen@v0.0.0-20160826115606-cf49914b915a/unmarshalmap/testpkg/structs.go (about)

     1  package testpkg
     2  
     3  //go:generate go run ../../cmd/gounmarshalmap/main.go -o simple_struct_unmarshalmap.go SimpleStruct
     4  
     5  type SimpleStruct struct {
     6  	SimpleField             string
     7  	SimpleJSONTagged        string  `json:"field2"`
     8  	SimpleJSONTaggedOmitted string  `json:"field3,omitempty"`
     9  	SimpleOmitEmptyNoName   string  `json:",omitempty"`
    10  	SimpleSkipped           string  `json:"-,omitempty"`
    11  	SimplePointer           *string `json:"pointer"`
    12  	SimpleInteger           int     `json:"integer"`
    13  	SimpleIntegerPtr        *int    `json:"integer_ptr"`
    14  	Ignored                 string  `json:"-"`
    15  }
    16  
    17  //go:generate go run ../../cmd/gounmarshalmap/main.go -o array_unmarshalmap.go Array
    18  
    19  type Array struct {
    20  	List []string
    21  	//ListPointers []*string
    22  	// PointerToList *[]string
    23  }
    24  
    25  type Embedded struct {
    26  	Field string
    27  }
    28  
    29  //go:generate go run ../../cmd/gounmarshalmap/main.go -o composed_unmarshalmap.go Composed
    30  
    31  type Composed struct {
    32  	Embedded
    33  	Base string
    34  }
    35  
    36  //go:generate go run ../../cmd/gounmarshalmap/main.go -o nested_unmarshalmap.go Nested
    37  
    38  type Nested struct {
    39  	First  Embedded
    40  	Second *Embedded
    41  	Third  []Embedded
    42  	Fourth []*Embedded
    43  	Fifth  [3]Embedded
    44  	Sixth  [3]*Embedded
    45  	// TODO: Implement map support
    46  	// Seventh map[string]Embedded
    47  	// Eight   map[string]*Embedded
    48  	// Nineth  map[int]Embedded
    49  	// Tenth   map[int]*Embedded
    50  }