From 8e07b6387733dd6bd21c7aba0bd76d405d6e2132 Mon Sep 17 00:00:00 2001 From: Yehoshua Sandler Date: Tue, 15 Apr 2025 16:46:13 -0500 Subject: [PATCH] feat: add quick reference to SQL token types --- docs/SQL_Token_Types.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/SQL_Token_Types.md diff --git a/docs/SQL_Token_Types.md b/docs/SQL_Token_Types.md new file mode 100644 index 0000000..b9c18c3 --- /dev/null +++ b/docs/SQL_Token_Types.md @@ -0,0 +1,37 @@ +These are the SQL Token Types that will serve as the foundation on how we interpret SQL strings +and create our `Query` structs + +```go +type TokenType int + +const ( + ERROR TokenType = iota // 0 + EOF // 1 + SPACE // 2 space or newline + STRING // 3 string literal + INCOMPLETE_STRING // 4 incomplete string literal so that we can obfuscate it, e.g. 'abc + NUMBER // 5 number literal + IDENT // 6 identifier column name + QUOTED_IDENT // 7 quoted identifier + OPERATOR // 8 operator like = > < >= <= + WILDCARD // 9 wildcard * + COMMENT // 10 comment + MULTILINE_COMMENT // 11 multiline comment + PUNCTUATION // 12 punctuation such as a comma + DOLLAR_QUOTED_FUNCTION // 13 dollar quoted function + DOLLAR_QUOTED_STRING // 14 dollar quoted string + POSITIONAL_PARAMETER // 15 numbered parameter + BIND_PARAMETER // 16 bind parameter + FUNCTION // 17 function + SYSTEM_VARIABLE // 18 system variable + UNKNOWN // 19 unknown token + COMMAND // 20 SQL commands like SELECT INSERT UPDATE DELETE + KEYWORD // 21 Other SQL keywords like FROM, WHERE, NOT, IS, LIKE + JSON_OP // 22 JSON operators + BOOLEAN // 23 boolean literal + NULL // 24 null literal + PROC_INDICATOR // 25 procedure indicator + CTE_INDICATOR // 26 CTE indicator + ALIAS_INDICATOR // 27 alias indicator +) +```