Skip to content

Commit

Permalink
Document omitempty
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Apr 28, 2020
1 parent 853fa18 commit 331aabc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mapstructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@
// "address": "123 Maple St.",
// }
//
// Omit Empty Values
//
// When decoding from a struct to any other value, you may use the
// ",omitempty" suffix on your tag to omit that value if it equates to
// the zero value. The zero value of all types is specified in the Go
// specification.
//
// For example, the zero type of a numeric type is zero ("0"). If the struct
// field value is zero and a numeric type, the field is empty, and it won't
// be encoded into the destination type.
//
// type Source {
// Age int `mapstructure:",omitempty"`
// }
//
// Other Configuration
//
// mapstructure is highly configurable. See the DecoderConfig struct
Expand Down

0 comments on commit 331aabc

Please sign in to comment.