MCPcopy
hub / github.com/pingcap/tidb / NewDatum

Function NewDatum

pkg/types/datum.go:2277–2285  ·  view source on GitHub ↗

NewDatum creates a new Datum from an interface{}.

(in any)

Source from the content-addressed store, hash-verified

2275
2276// NewDatum creates a new Datum from an interface{}.
2277func NewDatum(in any) (d Datum) {
2278 switch x := in.(type) {
2279 case []any:
2280 d.SetValueWithDefaultCollation(MakeDatums(x...))
2281 default:
2282 d.SetValueWithDefaultCollation(in)
2283 }
2284 return d
2285}
2286
2287// NewIntDatum creates a new Datum from an int64 value.
2288func NewIntDatum(i int64) (d Datum) {

Callers 15

BuildMergeJoinPlanFunction · 0.92
TestCaseWhenFunction · 0.92
TestCastFunction · 0.92
TestBuildExpressionFunction · 0.92
tryToPushDownAggMethod · 0.92
rewriteUserVariableMethod · 0.92
rewriteFuncCallMethod · 0.92
funcCallToExpressionMethod · 0.92
toTableMethod · 0.92
jsonValue2ExprFunction · 0.92
row_count_index.goFile · 0.92

Calls 2

MakeDatumsFunction · 0.70

Tested by 15

TestCaseWhenFunction · 0.74
TestCastFunction · 0.74
TestBuildExpressionFunction · 0.74
TestEmptyTableFunction · 0.74
TestDDLAfterLoadFunction · 0.74
TestPartialNextFunction · 0.74
TestVectorDatumFunction · 0.74
TestValueExprRestoreFunction · 0.74
TestValueExprFormatFunction · 0.74
TestRowToTTLTaskFunction · 0.74
TestInsertIntoTTLTaskFunction · 0.74