We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1dc4f04 + 656e9ed commit 738c1fdCopy full SHA for 738c1fd
models_test.go
@@ -184,11 +184,22 @@ type Company struct {
184
ID string `jsonapi:"primary,companies"`
185
Name string `jsonapi:"attr,name"`
186
Boss Employee `jsonapi:"attr,boss"`
187
+ Manager *Employee `jsonapi:"attr,manager"`
188
Teams []Team `jsonapi:"attr,teams"`
189
People []*People `jsonapi:"attr,people"`
190
FoundedAt time.Time `jsonapi:"attr,founded-at,iso8601"`
191
}
192
193
+type CompanyOmitEmpty struct {
194
+ ID string `jsonapi:"primary,companies"`
195
+ Name string `jsonapi:"attr,name,omitempty"`
196
+ Boss Employee `jsonapi:"attr,boss,omitempty"`
197
+ Manager *Employee `jsonapi:"attr,manager,omitempty"`
198
+ Teams []Team `jsonapi:"attr,teams,omitempty"`
199
+ People []*People `jsonapi:"attr,people,omitempty"`
200
+ FoundedAt time.Time `jsonapi:"attr,founded-at,iso8601,omitempty"`
201
+}
202
+
203
type People struct {
204
205
Age int `jsonapi:"attr,age"`
0 commit comments