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

Function MakeCollatedString

pkg/sql/types/types.go:987–993  ·  view source on GitHub ↗

MakeCollatedString constructs a new instance of a CollatedStringFamily type that is collated according to the given locale. The new type is based upon the given string type, having the same oid and width values. For example: STRING => STRING COLLATE EN VARCHAR(20) => VARCHAR(20) COLLATE EN

(strType *T, locale string)

Source from the content-addressed store, hash-verified

985// STRING => STRING COLLATE EN
986// VARCHAR(20) => VARCHAR(20) COLLATE EN
987func MakeCollatedString(strType *T, locale string) *T {
988 if oidCanBeCollatedString(strType.Oid()) {
989 return &T{InternalType: InternalType{
990 Family: CollatedStringFamily, Oid: strType.Oid(), Width: strType.Width(), Locale: &locale}}
991 }
992 panic(errors.AssertionFailedf("cannot apply collation to non-string type: %s", strType))
993}
994
995// MakeCollatedType is like MakeCollatedString but also handles NULL and arrays
996// of string types that need to become arrays of collated string types.

Callers 6

GetTypeFromCastOrCollateFunction · 0.92
ResolvedTypeMethod · 0.92
TypeCheckMethod · 0.92
processCollationOnTypeFunction · 0.92
ParseMethod · 0.92
MakeCollatedTypeFunction · 0.85

Calls 3

oidCanBeCollatedStringFunction · 0.85
OidMethod · 0.80
WidthMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…