Merge pull request #184 from yamil-rivera/master
Including 'Unexported fields' section to the docs
Mitchell Hashimoto authored 4 years ago
GitHub committed 4 years ago
113 | 113 | // type Source { |
114 | 114 | // Age int `mapstructure:",omitempty"` |
115 | 115 | // } |
116 | // | |
117 | // Unexported fields | |
118 | // | |
119 | // Since unexported (private) struct fields cannot be set outside the package | |
120 | // where they are defined, the decoder will simply skip them. | |
121 | // | |
122 | // For this output type definition: | |
123 | // | |
124 | // type Exported struct { | |
125 | // private string // this unexported field will be skipped | |
126 | // Public string | |
127 | // } | |
128 | // | |
129 | // Using this map as input: | |
130 | // | |
131 | // map[string]interface{}{ | |
132 | // "private": "I will be ignored", | |
133 | // "Public": "I made it through!", | |
134 | // } | |
135 | // | |
136 | // The following struct will be decoded: | |
137 | // | |
138 | // type Exported struct { | |
139 | // private: "" // field is left with an empty string (zero value) | |
140 | // Public: "I made it through!" | |
116 | 141 | // |
117 | 142 | // Other Configuration |
118 | 143 | // |