Encode encodes the value using the given Encoder. It traverses the value, iterating over arrays, slices, maps and the exported fields of structs. If it encounters a non-nil pointer, it encodes the value that it points to. Encode treats a few interfaces specially: If the value implements encoding.Bi
(v reflect.Value, e Encoder)
| 112 | // unsigned), and types that implement encoding.TextMarshaler are permitted as map |
| 113 | // keys. These restrictions match exactly those of the encoding/json package. |
| 114 | func Encode(v reflect.Value, e Encoder) error { |
| 115 | return wrap(encode(v, e), gcerr.InvalidArgument) |
| 116 | } |
| 117 | |
| 118 | func encode(v reflect.Value, enc Encoder) error { |
| 119 | if !v.IsValid() { |