| 1 |
package decoder |
| 2 |
|
| 3 |
import ( |
| 4 |
"context" |
| 5 |
"encoding" |
| 6 |
"encoding/json" |
| 7 |
"reflect" |
| 8 |
"unsafe" |
| 9 |
) |
| 10 |
|
| 11 |
type Decoder interface { |
| 12 |
Decode(*RuntimeContext, int64, int64, unsafe.Pointer) (int64, error) |
| 13 |
DecodePath(*RuntimeContext, int64, int64) ([][]byte, int64, error) |
| 14 |
} |
| 15 |
|
| 16 |
const ( |
| 17 |
nul = '\000' |
| 18 |
maxDecodeNestingDepth = 10000 |
| 19 |
) |
| 20 |
|
| 21 |
type unmarshalerContext interface { |
| 22 |
UnmarshalJSON(context.Context, []byte) error |
| 23 |
} |
| 24 |
|
| 25 |
var ( |
| 26 |
unmarshalJSONType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() |
| 27 |
unmarshalJSONContextType = reflect.TypeOf((*unmarshalerContext)(nil)).Elem() |
| 28 |
unmarshalTextType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() |
| 29 |
) |