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)
| 985 | // STRING => STRING COLLATE EN |
| 986 | // VARCHAR(20) => VARCHAR(20) COLLATE EN |
| 987 | func 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. |
no test coverage detected
searching dependent graphs…