Decode the data in the supplied data slice.
(data []byte, v interface{})
| 39 | |
| 40 | // Decode the data in the supplied data slice. |
| 41 | func (d *Decoder) Decode(data []byte, v interface{}) error { |
| 42 | f, ok := v.(unmarshalFaster) |
| 43 | if ok { |
| 44 | if d.fs == nil { |
| 45 | d.fs = fflib.NewFFLexer(data) |
| 46 | } else { |
| 47 | d.fs.Reset(data) |
| 48 | } |
| 49 | return f.UnmarshalJSONFFLexer(d.fs, fflib.FFParse_map_start) |
| 50 | } |
| 51 | |
| 52 | um, ok := v.(json.Unmarshaler) |
| 53 | if ok { |
| 54 | return um.UnmarshalJSON(data) |
| 55 | } |
| 56 | return json.Unmarshal(data, v) |
| 57 | } |
| 58 | |
| 59 | // Decode the data from the supplied reader. |
| 60 | // You should expect that data is read into memory before it is decoded. |
no test coverage detected