MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / GetKeywordID

Function GetKeywordID

pkg/sql/lexbase/keywords.go:1307–1961  ·  view source on GitHub ↗

GetKeywordID returns the lex id of the SQL keyword k or IDENT if k is not a keyword.

(k string)

Source from the content-addressed store, hash-verified

1305// GetKeywordID returns the lex id of the SQL keyword k or IDENT if k is
1306// not a keyword.
1307func GetKeywordID(k string) int32 {
1308 // The previous implementation generated a map that did a string ->
1309 // id lookup. Various ideas were benchmarked and the implementation below
1310 // was the fastest of those, between 3% and 10% faster (at parsing, so the
1311 // scanning speedup is even more) than the map implementation.
1312 switch k {
1313 case "abort": return ABORT
1314 case "absolute": return ABSOLUTE
1315 case "access": return ACCESS
1316 case "action": return ACTION
1317 case "add": return ADD
1318 case "admin": return ADMIN
1319 case "after": return AFTER
1320 case "aggregate": return AGGREGATE
1321 case "all": return ALL
1322 case "alter": return ALTER
1323 case "always": return ALWAYS
1324 case "analyse": return ANALYSE
1325 case "analyze": return ANALYZE
1326 case "and": return AND
1327 case "annotate_type": return ANNOTATE_TYPE
1328 case "any": return ANY
1329 case "array": return ARRAY
1330 case "as": return AS
1331 case "asc": return ASC
1332 case "asensitive": return ASENSITIVE
1333 case "asymmetric": return ASYMMETRIC
1334 case "as_json": return AS_JSON
1335 case "at": return AT
1336 case "atomic": return ATOMIC
1337 case "attribute": return ATTRIBUTE
1338 case "authorization": return AUTHORIZATION
1339 case "automatic": return AUTOMATIC
1340 case "availability": return AVAILABILITY
1341 case "avoid_full_scan": return AVOID_FULL_SCAN
1342 case "backup": return BACKUP
1343 case "backups": return BACKUPS
1344 case "backward": return BACKWARD
1345 case "batch": return BATCH
1346 case "before": return BEFORE
1347 case "begin": return BEGIN
1348 case "between": return BETWEEN
1349 case "bidirectional": return BIDIRECTIONAL
1350 case "bigint": return BIGINT
1351 case "binary": return BINARY
1352 case "bit": return BIT
1353 case "boolean": return BOOLEAN
1354 case "both": return BOTH
1355 case "box2d": return BOX2D
1356 case "bucket_count": return BUCKET_COUNT
1357 case "bundle": return BUNDLE
1358 case "by": return BY
1359 case "bypassrls": return BYPASSRLS
1360 case "cache": return CACHE
1361 case "call": return CALL
1362 case "called": return CALLED
1363 case "cancel": return CANCEL
1364 case "cancelquery": return CANCELQUERY

Callers 1

scanIdentMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…