feat: comments for all operators (#917)

This commit is contained in:
Igor Izvekov 2023-07-17 21:42:28 +03:00 committed by GitHub
parent d6ebb58b96
commit c8b6e7f2c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,8 +28,11 @@ use super::display_separated;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
pub enum UnaryOperator { pub enum UnaryOperator {
/// Plus, e.g. `+9`
Plus, Plus,
/// Minus, e.g. `-9`
Minus, Minus,
/// Not, e.g. `NOT(true)`
Not, Not,
/// Bitwise Not, e.g. `~9` (PostgreSQL-specific) /// Bitwise Not, e.g. `~9` (PostgreSQL-specific)
PGBitwiseNot, PGBitwiseNot,
@ -66,24 +69,43 @@ impl fmt::Display for UnaryOperator {
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
pub enum BinaryOperator { pub enum BinaryOperator {
/// Plus, e.g. `a + b`
Plus, Plus,
/// Minus, e.g. `a - b`
Minus, Minus,
/// Multiply, e.g. `a * b`
Multiply, Multiply,
/// Divide, e.g. `a / b`
Divide, Divide,
/// Modulo, e.g. `a % b`
Modulo, Modulo,
/// String/Array Concat operator, e.g. `a || b`
StringConcat, StringConcat,
/// Greater than, e.g. `a > b`
Gt, Gt,
/// Less than, e.g. `a < b`
Lt, Lt,
/// Greater equal, e.g. `a >= b`
GtEq, GtEq,
/// Less equal, e.g. `a <= b`
LtEq, LtEq,
/// Spaceship, e.g. `a <=> b`
Spaceship, Spaceship,
/// Equal, e.g. `a = b`
Eq, Eq,
/// Not equal, e.g. `a <> b`
NotEq, NotEq,
/// And, e.g. `a AND b`
And, And,
/// Or, e.g. `a OR b`
Or, Or,
/// XOR, e.g. `a XOR b`
Xor, Xor,
/// Bitwise or, e.g. `a | b`
BitwiseOr, BitwiseOr,
/// Bitwise and, e.g. `a & b`
BitwiseAnd, BitwiseAnd,
/// Bitwise XOR, e.g. `a ^ b`
BitwiseXor, BitwiseXor,
/// Integer division operator `//` in DuckDB /// Integer division operator `//` in DuckDB
DuckIntegerDivide, DuckIntegerDivide,
@ -91,14 +113,23 @@ pub enum BinaryOperator {
MyIntegerDivide, MyIntegerDivide,
/// Support for custom operators (built by parsers outside this crate) /// Support for custom operators (built by parsers outside this crate)
Custom(String), Custom(String),
/// Bitwise XOR, e.g. `a # b` (PostgreSQL-specific)
PGBitwiseXor, PGBitwiseXor,
/// Bitwise shift left, e.g. `a << b` (PostgreSQL-specific)
PGBitwiseShiftLeft, PGBitwiseShiftLeft,
/// Bitwise shift right, e.g. `a >> b` (PostgreSQL-specific)
PGBitwiseShiftRight, PGBitwiseShiftRight,
/// Exponent, e.g. `a ^ b` (PostgreSQL-specific)
PGExp, PGExp,
/// Overlap operator, e.g. `a && b` (PostgreSQL-specific)
PGOverlap, PGOverlap,
/// String matches regular expression (case sensitively), e.g. `a ~ b` (PostgreSQL-specific)
PGRegexMatch, PGRegexMatch,
/// String matches regular expression (case insensitively), e.g. `a ~* b` (PostgreSQL-specific)
PGRegexIMatch, PGRegexIMatch,
/// String does not match regular expression (case sensitively), e.g. `a !~ b` (PostgreSQL-specific)
PGRegexNotMatch, PGRegexNotMatch,
/// String does not match regular expression (case insensitively), e.g. `a !~* b` (PostgreSQL-specific)
PGRegexNotIMatch, PGRegexNotIMatch,
/// PostgreSQL-specific custom operator. /// PostgreSQL-specific custom operator.
/// ///