MCPcopy Create free account
hub / github.com/pingcap/tidb / UnmarshalJSON

Method UnmarshalJSON

pkg/types/json_binary.go:524–539  ·  view source on GitHub ↗

UnmarshalJSON implements the json.Unmarshaler interface.

(data []byte)

Source from the content-addressed store, hash-verified

522
523// UnmarshalJSON implements the json.Unmarshaler interface.
524func (bj *BinaryJSON) UnmarshalJSON(data []byte) error {
525 var decoder = json.NewDecoder(bytes.NewReader(data))
526 decoder.UseNumber()
527 var in any
528 err := decoder.Decode(&in)
529 if err != nil {
530 return errors.Trace(err)
531 }
532 newBj, err := CreateBinaryJSONWithCheck(in)
533 if err != nil {
534 return errors.Trace(err)
535 }
536 bj.TypeCode = newBj.TypeCode
537 bj.Value = newBj.Value
538 return nil
539}
540
541func getInt64FractionLength(i int64) int {
542 absInt := uint64(0)

Callers 4

BuildRowsMethod · 0.95

Calls 3

NewDecoderMethod · 0.80
DecodeMethod · 0.65

Tested by

no test coverage detected