MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / toUpper

Function toUpper

pkg/sql/parser/preprocess.go:168–187  ·  view source on GitHub ↗

toUpper converts s to uppercase using a pooled byte buffer for short strings.

(s string)

Source from the content-addressed store, hash-verified

166
167// toUpper converts s to uppercase using a pooled byte buffer for short strings.
168func toUpper(s string) string {
169 n := len(s)
170 var upper []byte
171 if n <= 32 {
172 bufPtr := kwBufPool.Get().(*[]byte)
173 upper = (*bufPtr)[:n]
174 defer kwBufPool.Put(bufPtr)
175 } else {
176 upper = make([]byte, n)
177 }
178 for i := 0; i < n; i++ {
179 c := s[i]
180 if c >= 'a' && c <= 'z' {
181 upper[i] = c - 32
182 } else {
183 upper[i] = c
184 }
185 }
186 return string(upper)
187}
188
189// identifierKeywordType remaps identifiers that carry SQL keyword values to
190// their specific models.TokenType. This is conservative: only keywords that

Callers 2

identifierKeywordTypeFunction · 0.85
keywordTypeFunction · 0.85

Calls 2

PutMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected