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

Method GetValue

pkg/types/json_binary.go:619–636  ·  view source on GitHub ↗

GetValue return the primitive value of the JSON.

()

Source from the content-addressed store, hash-verified

617
618// GetValue return the primitive value of the JSON.
619func (bj BinaryJSON) GetValue() any {
620 switch bj.TypeCode {
621 case JSONTypeCodeInt64:
622 return bj.GetInt64()
623 case JSONTypeCodeUint64:
624 return bj.GetUint64()
625 case JSONTypeCodeDuration:
626 return bj.GetDuration()
627 case JSONTypeCodeFloat64:
628 return bj.GetFloat64()
629 case JSONTypeCodeString:
630 return bj.GetString()
631 case JSONTypeCodeDate, JSONTypeCodeDatetime:
632 return bj.GetTime()
633 }
634 logutil.BgLogger().Error("unreachable JSON type", zap.Any("type", bj.TypeCode))
635 return nil
636}
637
638// CreateBinaryJSON creates a BinaryJSON from interface.
639func CreateBinaryJSON(in any) BinaryJSON {

Callers

nothing calls this directly

Calls 8

GetInt64Method · 0.95
GetUint64Method · 0.95
GetDurationMethod · 0.95
GetFloat64Method · 0.95
GetStringMethod · 0.95
GetTimeMethod · 0.95
BgLoggerFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected