github.com/night-codes/go-json@v0.9.15/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 DecodeStream(*Stream, int64, unsafe.Pointer) 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 )