MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / MakeArray

Function MakeArray

pkg/sql/types/types.go:1230–1245  ·  view source on GitHub ↗

MakeArray constructs a new instance of an ArrayFamily type with the given element type (which may itself be an ArrayFamily type).

(typ *T)

Source from the content-addressed store, hash-verified

1228// MakeArray constructs a new instance of an ArrayFamily type with the given
1229// element type (which may itself be an ArrayFamily type).
1230func MakeArray(typ *T) *T {
1231 // Do not make an array of type unknown[]. Follow Postgres' behavior and convert
1232 // this to type string[]. Likewise, Any does not have an array type, so treat it
1233 // as an array of strings.
1234 if typ.Family() == UnknownFamily ||
1235 (typ.Family() == AnyFamily && typ.Oid() == oid.T_any) {
1236 typ = String
1237 }
1238 arr := &T{InternalType: InternalType{
1239 Family: ArrayFamily,
1240 Oid: CalcArrayOid(typ),
1241 ArrayContents: typ,
1242 Locale: &emptyLocale,
1243 }}
1244 return arr
1245}
1246
1247// MakeTuple constructs a new instance of a TupleFamily type with the given
1248// field types (some/all of which may be other TupleFamily types).

Callers 15

arrayOfFunction · 0.92
ResolveTypeFunction · 0.92
FormatMethod · 0.92
ParseDArrayFromStringFunction · 0.92
ResolvedTypeMethod · 0.92
NewTypedArrayFlattenExprFunction · 0.92
eval.goFile · 0.92
cmpOpFixupsFunction · 0.92
TypeCheckMethod · 0.92
TypeCheckMethod · 0.92

Calls 3

CalcArrayOidFunction · 0.85
FamilyMethod · 0.80
OidMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…