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

Method collatedStringTypeSQL

pkg/sql/types/types.go:2030–2040  ·  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

2028// VARCHAR(20)[] COLLATE DE
2029//
2030func (t *T) collatedStringTypeSQL(isArray bool) string {
2031 var buf bytes.Buffer
2032 buf.WriteString(t.stringTypeSQL())
2033 if isArray {
2034 buf.WriteString("[] COLLATE ")
2035 } else {
2036 buf.WriteString(" COLLATE ")
2037 }
2038 lex.EncodeLocaleName(&buf, t.Locale())
2039 return buf.String()
2040}
2041
2042// stringTypeSQL returns the visible type name plus any width specifier for the
2043// 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