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

Method IsKeyword

pkg/sql/keywords/categories.go:139–145  ·  view source on GitHub ↗

IsKeyword checks if a string is a recognized SQL keyword. Returns true if the word is found in the keyword map, false otherwise. The check is case-insensitive when the Keywords instance was created with case-insensitive matching (default). Example: kw := keywords.New(keywords.DialectGeneric, tru

(s string)

Source from the content-addressed store, hash-verified

137// kw.IsKeyword("select") // true (case-insensitive)
138// kw.IsKeyword("unknown") // false
139func (k *Keywords) IsKeyword(s string) bool {
140 if k.ignoreCase {
141 s = strings.ToUpper(s)
142 }
143 _, ok := k.keywordMap[s]
144 return ok
145}
146
147// GetKeywordType returns the token type for a keyword
148func (k *Keywords) GetKeywordType(s string) models.TokenType {

Calls

no outgoing calls