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

Method collatedStringTypeSQL

pkg/sql/types/types.go:3013–3023  ·  view source on GitHub ↗

collatedStringTypeSQL returns the string representation of a COLLATEDSTRING or []COLLATEDSTRING type. This is tricky in the case of an array of collated string, since brackets must precede the COLLATE identifier: STRING COLLATE EN VARCHAR(20)[] COLLATE DE

(isArray bool)

Source from the content-addressed store, hash-verified

3011// STRING COLLATE EN
3012// VARCHAR(20)[] COLLATE DE
3013func (t *T) collatedStringTypeSQL(isArray bool) string {
3014 var buf bytes.Buffer
3015 buf.WriteString(t.stringTypeSQL())
3016 if isArray {
3017 buf.WriteString("[] COLLATE ")
3018 } else {
3019 buf.WriteString(" COLLATE ")
3020 }
3021 lex.EncodeLocaleName(&buf, t.Locale())
3022 return buf.String()
3023}
3024
3025// stringTypeSQL returns the visible type name plus any width specifier for the
3026// STRING/COLLATEDSTRING type.

Callers 1

SQLStringMethod · 0.95

Calls 4

stringTypeSQLMethod · 0.95
LocaleMethod · 0.95
EncodeLocaleNameFunction · 0.92
StringMethod · 0.65

Tested by

no test coverage detected