MCPcopy Create free account
hub / github.com/PostHog/duckgres / parseIdentifierPart

Function parseIdentifierPart

server/sqlcore/identifier.go:85–113  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

83}
84
85func parseIdentifierPart(s string) (string, bool) {
86 s = strings.TrimSpace(s)
87 if s == "" {
88 return "", false
89 }
90 if s[0] != '"' {
91 if strings.ContainsAny(s, "\" \t\n\r\f") {
92 return "", false
93 }
94 return strings.ToLower(s), true
95 }
96 if len(s) < 2 || s[len(s)-1] != '"' {
97 return "", false
98 }
99
100 var ident strings.Builder
101 for i := 1; i < len(s)-1; i++ {
102 if s[i] == '"' {
103 if i+1 >= len(s)-1 || s[i+1] != '"' {
104 return "", false
105 }
106 ident.WriteByte('"')
107 i++
108 continue
109 }
110 ident.WriteByte(s[i])
111 }
112 return ident.String(), true
113}

Callers 1

ParseQualifiedIdentifierFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected