github.com/grbit/go-json@v0.11.0/internal/decoder/type.go (about) 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 DecodeStream(*Stream, int64, unsafe.Pointer) error 15 } 16 17 const ( 18 nul = '\000' 19 maxDecodeNestingDepth = 10000 20 ) 21 22 type unmarshalerContext interface { 23 UnmarshalJSON(context.Context, []byte) error 24 } 25 26 var ( 27 unmarshalJSONType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() 28 unmarshalJSONContextType = reflect.TypeOf((*unmarshalerContext)(nil)).Elem() 29 unmarshalTextType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() 30 )