Skip to content

Commit

Permalink
BREAKING! Change SymbolOperator type to plain string
Browse files Browse the repository at this point in the history
  • Loading branch information
nene committed Dec 21, 2023
1 parent ca9faaa commit 0579156
Showing 1 changed file with 30 additions and 33 deletions.
63 changes: 30 additions & 33 deletions src/cst/Expr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,39 +85,36 @@ export interface BinaryExpr<
right: TRight;
}

type SymbolOperator =
// standard arithmetics
| "+"
| "-"
| "*"
| "/"
| "%" // SQLite, MySQL, PostgreSQL
// comparison
| "="
| "==" // SQLite
| "<"
| ">"
| ">="
| "<="
| "<>"
| "!="
| "<=>" // MySQL
// string concat
| "||" // OR in MySQL
| "" // MySQL concatenation of adjecent string literals
// Logic
| "&&" // MySQL
// JSON
| "->" // SQLite, MySQL
| "->>" // SQLite, MySQL
// bitwise
| "&"
| "|"
| ">>"
| "<<"
| "^" // BigQuery, MySQL, PostgreSQL (exp)
// Assignment
| ":="; // MySQL
/**
* We can't enumerate all operators because PostgreSQL allows custom operators.
* So this type is just alias for string.
*
* However, for reference, here's a list of the usual operators and to which dialects they apply:
*
* arithmetics:
* + - * /
* % (SQLite, MySQL, PostgreSQL)
* ^ (PostgreSQL)
* comparison:
* = < > >= <= <> !=
* == (SQLite)
* <=> (MySQL)
* string concatenation:
* || (except in MySQL)
* "" (empty string - in MySQL adjecent strings get concatenated)
* logic:
* && (MySQL AND)
* || (MySQL)
* JSON:
* -> (SQLite, MySQL)
* ->> (SQLite, MySQL)
* bitwise:
* & | >> <<
* ^ (BigQuery and MySQL)
* assignment:
* := (MySQL)
*/
type SymbolOperator = string;

type KeywordOperator =
// arithmetic
Expand Down

0 comments on commit 0579156

Please sign in to comment.