GetKeywordID returns the lex id of the SQL keyword k or IDENT if k is not a keyword.
(k string)
| 843 | // GetKeywordID returns the lex id of the SQL keyword k or IDENT if k is |
| 844 | // not a keyword. |
| 845 | func GetKeywordID(k string) int32 { |
| 846 | // The previous implementation generated a map that did a string -> |
| 847 | // id lookup. Various ideas were benchmarked and the implementation below |
| 848 | // was the fastest of those, between 3% and 10% faster (at parsing, so the |
| 849 | // scanning speedup is even more) than the map implementation. |
| 850 | switch k { |
| 851 | case "abort": |
| 852 | return ABORT |
| 853 | case "action": |
| 854 | return ACTION |
| 855 | case "add": |
| 856 | return ADD |
| 857 | case "admin": |
| 858 | return ADMIN |
| 859 | case "aggregate": |
| 860 | return AGGREGATE |
| 861 | case "all": |
| 862 | return ALL |
| 863 | case "alter": |
| 864 | return ALTER |
| 865 | case "analyse": |
| 866 | return ANALYSE |
| 867 | case "analyze": |
| 868 | return ANALYZE |
| 869 | case "and": |
| 870 | return AND |
| 871 | case "annotate_type": |
| 872 | return ANNOTATE_TYPE |
| 873 | case "any": |
| 874 | return ANY |
| 875 | case "array": |
| 876 | return ARRAY |
| 877 | case "as": |
| 878 | return AS |
| 879 | case "asc": |
| 880 | return ASC |
| 881 | case "asymmetric": |
| 882 | return ASYMMETRIC |
| 883 | case "at": |
| 884 | return AT |
| 885 | case "authorization": |
| 886 | return AUTHORIZATION |
| 887 | case "automatic": |
| 888 | return AUTOMATIC |
| 889 | case "backup": |
| 890 | return BACKUP |
| 891 | case "begin": |
| 892 | return BEGIN |
| 893 | case "between": |
| 894 | return BETWEEN |
| 895 | case "bigint": |
| 896 | return BIGINT |
| 897 | case "bigserial": |
| 898 | return BIGSERIAL |
| 899 | case "bit": |
| 900 | return BIT |
| 901 | case "blob": |
| 902 | return BLOB |
no outgoing calls
no test coverage detected
searching dependent graphs…