Skip to content

Commit 15b1d85

Browse files
committed
Add omitzero mention in README
1 parent 51fad25 commit 15b1d85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ It is important to make sure your JSON expression returns a value that has a typ
279279

280280
### Model and DTO recommendations
281281

282-
- Use `json:",omitempty"` on all DTO fields.
282+
- Use `json:",omitempty"` on all DTO fields. (or `json:",omitzero"` for struct fields like `time.Time`)
283283
- *Note: using `omitempty` on slices will remove them from the json result if they are not nil and empty. There is currently no solution to this problem using the standard json package.*
284284
- Don't include the foreign keys in the DTO.
285285
- Use `*null.Time` from the [`gopkg.in/guregu/null.v4`](https://github.com/guregu/null) library instead of `sql.NullTime`.

0 commit comments

Comments
 (0)