MCPcopy
hub / github.com/sqldef/sqldef / hasKeywordAt

Function hasKeywordAt

database/mssql/parser.go:335–347  ·  view source on GitHub ↗
(sql string, pos int, keyword string)

Source from the content-addressed store, hash-verified

333}
334
335func hasKeywordAt(sql string, pos int, keyword string) bool {
336 if pos < 0 || pos+len(keyword) > len(sql) {
337 return false
338 }
339 if !strings.EqualFold(sql[pos:pos+len(keyword)], keyword) {
340 return false
341 }
342 if pos > 0 && isIdentChar(sql[pos-1]) {
343 return false
344 }
345 end := pos + len(keyword)
346 return end == len(sql) || !isIdentChar(sql[end])
347}
348
349func isIdentChar(ch byte) bool {
350 return ch == '_' ||

Calls 1

isIdentCharFunction · 0.85

Tested by

no test coverage detected