Encode encodes the document using the given Encoder.
(e Encoder)
| 169 | |
| 170 | // Encode encodes the document using the given Encoder. |
| 171 | func (d Document) Encode(e Encoder) error { |
| 172 | if d.m != nil { |
| 173 | return encodeMap(reflect.ValueOf(d.m), e) |
| 174 | } |
| 175 | return encodeStructWithFields(d.s, d.fields, e) |
| 176 | } |
| 177 | |
| 178 | // Decode decodes the document using the given Decoder. |
| 179 | func (d Document) Decode(dec Decoder) error { |