Skip to content

Commit

Permalink
Merge pull request #184 from yamil-rivera/master
Browse files Browse the repository at this point in the history
Including 'Unexported fields' section to the docs
  • Loading branch information
mitchellh committed Apr 28, 2020
2 parents 331aabc + 57698e0 commit 55652fb
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mapstructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,31 @@
// Age int `mapstructure:",omitempty"`
// }
//
// Unexported fields
//
// Since unexported (private) struct fields cannot be set outside the package
// where they are defined, the decoder will simply skip them.
//
// For this output type definition:
//
// type Exported struct {
// private string // this unexported field will be skipped
// Public string
// }
//
// Using this map as input:
//
// map[string]interface{}{
// "private": "I will be ignored",
// "Public": "I made it through!",
// }
//
// The following struct will be decoded:
//
// type Exported struct {
// private: "" // field is left with an empty string (zero value)
// Public: "I made it through!"
//
// Other Configuration
//
// mapstructure is highly configurable. See the DecoderConfig struct
Expand Down

0 comments on commit 55652fb

Please sign in to comment.