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)
| 137 | // kw.IsKeyword("select") // true (case-insensitive) |
| 138 | // kw.IsKeyword("unknown") // false |
| 139 | func (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 |
| 148 | func (k *Keywords) GetKeywordType(s string) models.TokenType { |
no outgoing calls