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