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

Function NewFieldType

pkg/types/field_type.go:41–51  ·  view source on GitHub ↗

NewFieldType returns a FieldType, with a type and other information about field type.

(tp byte)

Source from the content-addressed store, hash-verified

39// NewFieldType returns a FieldType,
40// with a type and other information about field type.
41func NewFieldType(tp byte) *FieldType {
42 charset1, collate1 := DefaultCharsetForType(tp)
43 flen, decimal := minFlenAndDecimalForType(tp)
44 return NewFieldTypeBuilder().
45 SetType(tp).
46 SetCharset(charset1).
47 SetCollate(collate1).
48 SetFlen(flen).
49 SetDecimal(decimal).
50 BuildP()
51}
52
53// NewFieldTypeWithCollation returns a FieldType,
54// with a type and other information about field type.

Callers 15

TestCreateTablesFunction · 0.92
TestGcFunction · 0.92
TestRegionSplitInfoFunction · 0.92
TestTheSessionIsoationFunction · 0.92
AddExtraPhysTblIDColumnFunction · 0.92
TestCastFunction · 0.92
TestBuildExpressionFunction · 0.92
buildExpandMethod · 0.92
coalesceCommonColumnsMethod · 0.92

Calls 9

DefaultCharsetForTypeFunction · 0.85
minFlenAndDecimalForTypeFunction · 0.85
NewFieldTypeBuilderFunction · 0.85
BuildPMethod · 0.80
SetTypeMethod · 0.65
SetDecimalMethod · 0.45
SetFlenMethod · 0.45
SetCollateMethod · 0.45
SetCharsetMethod · 0.45

Tested by 15

TestCreateTablesFunction · 0.74
TestGcFunction · 0.74
TestRegionSplitInfoFunction · 0.74
TestTheSessionIsoationFunction · 0.74
TestCastFunction · 0.74
TestBuildExpressionFunction · 0.74
TestDeepCloneFunction · 0.74
TestPhysicalPlanCloneFunction · 0.74