isDataTypeKeyword checks if current token is a SQL data type keyword
()
| 358 | |
| 359 | // isDataTypeKeyword checks if current token is a SQL data type keyword |
| 360 | func (p *Parser) isDataTypeKeyword() bool { |
| 361 | // Check Type for known data type tokens |
| 362 | switch p.currentToken.Token.Type { |
| 363 | case models.TokenTypeInt, models.TokenTypeInteger, models.TokenTypeVarchar, |
| 364 | models.TokenTypeText, models.TokenTypeBoolean, models.TokenTypeFloat, |
| 365 | models.TokenTypeInterval: |
| 366 | return true |
| 367 | } |
| 368 | // Fallback: check literal for data type keywords not all represented in models |
| 369 | switch strings.ToUpper(p.currentToken.Token.Value) { |
| 370 | case "INT", "INTEGER", "BIGINT", "SMALLINT", "FLOAT", "DOUBLE", "DECIMAL", |
| 371 | "NUMERIC", "VARCHAR", "CHAR", "TEXT", "BOOLEAN", "DATE", "TIME", |
| 372 | "TIMESTAMP", "INTERVAL", "BLOB", "CLOB", "JSON", "UUID": |
| 373 | return true |
| 374 | } |
| 375 | return false |
| 376 | } |
| 377 | |
| 378 | // isJSONOperator checks if current token is a JSON/JSONB operator |
| 379 | func (p *Parser) isJSONOperator() bool { |