pub enum Token {
Show 69 variants EOF, Word(Word), Number(String, bool), Char(char), SingleQuotedString(String), DoubleQuotedString(String), DollarQuotedString(DollarQuotedString), SingleQuotedByteStringLiteral(String), DoubleQuotedByteStringLiteral(String), RawStringLiteral(String), NationalStringLiteral(String), EscapedStringLiteral(String), HexStringLiteral(String), Comma, Whitespace(Whitespace), DoubleEq, Eq, Neq, Lt, Gt, LtEq, GtEq, Spaceship, Plus, Minus, Mul, Div, DuckIntDiv, Mod, StringConcat, LParen, RParen, Period, Colon, DoubleColon, DuckAssignment, SemiColon, Backslash, LBracket, RBracket, Ampersand, Pipe, Caret, LBrace, RBrace, RArrow, Sharp, Tilde, TildeAsterisk, ExclamationMarkTilde, ExclamationMarkTildeAsterisk, ShiftLeft, ShiftRight, Overlap, ExclamationMark, DoubleExclamationMark, AtSign, PGSquareRoot, PGCubeRoot, Placeholder(String), Arrow, LongArrow, HashArrow, HashLongArrow, AtArrow, ArrowAt, HashMinus, AtQuestion, AtAt,
}
Expand description

SQL Token enumeration

Variants§

§

EOF

An end-of-file marker, not a real token

§

Word(Word)

A keyword (like SELECT) or an optionally quoted SQL identifier

§

Number(String, bool)

An unsigned numeric literal

§

Char(char)

A character that could not be tokenized

§

SingleQuotedString(String)

Single quoted string: i.e: ‘string’

§

DoubleQuotedString(String)

Double quoted string: i.e: “string”

§

DollarQuotedString(DollarQuotedString)

Dollar quoted string: i.e: $$string$$ or $tag_name$string$tag_name$

§

SingleQuotedByteStringLiteral(String)

Byte string literal: i.e: b’string’ or B’string’

§

DoubleQuotedByteStringLiteral(String)

Byte string literal: i.e: b“string“ or B“string“

§

RawStringLiteral(String)

Raw string literal: i.e: r’string’ or R’string’ or r“string“ or R“string“

§

NationalStringLiteral(String)

“National” string literal: i.e: N’string’

§

EscapedStringLiteral(String)

“escaped” string literal, which are an extension to the SQL standard: i.e: e’first \n second’ or E ‘first \n second’

§

HexStringLiteral(String)

Hexadecimal string literal: i.e.: X’deadbeef’

§

Comma

Comma

§

Whitespace(Whitespace)

Whitespace (space, tab, etc)

§

DoubleEq

Double equals sign ==

§

Eq

Equality operator =

§

Neq

Not Equals operator <> (or != in some dialects)

§

Lt

Less Than operator <

§

Gt

Greater Than operator >

§

LtEq

Less Than Or Equals operator <=

§

GtEq

Greater Than Or Equals operator >=

§

Spaceship

Spaceship operator <=>

§

Plus

Plus operator +

§

Minus

Minus operator -

§

Mul

Multiplication operator *

§

Div

Division operator /

§

DuckIntDiv

Integer division operator // in DuckDB

§

Mod

Modulo Operator %

§

StringConcat

String concatenation ||

§

LParen

Left parenthesis (

§

RParen

Right parenthesis )

§

Period

Period (used for compound identifiers or projections into nested types)

§

Colon

Colon :

§

DoubleColon

DoubleColon :: (used for casting in postgresql)

§

DuckAssignment

Assignment := (used for keyword argument in DuckDB macros)

§

SemiColon

SemiColon ; used as separator for COPY and payload

§

Backslash

Backslash \ used in terminating the COPY payload with \.

§

LBracket

Left bracket [

§

RBracket

Right bracket ]

§

Ampersand

Ampersand &

§

Pipe

Pipe |

§

Caret

Caret ^

§

LBrace

Left brace {

§

RBrace

Right brace }

§

RArrow

Right Arrow =>

§

Sharp

Sharp # used for PostgreSQL Bitwise XOR operator

§

Tilde

Tilde ~ used for PostgreSQL Bitwise NOT operator or case sensitive match regular expression operator

§

TildeAsterisk

~* , a case insensitive match regular expression operator in PostgreSQL

§

ExclamationMarkTilde

!~ , a case sensitive not match regular expression operator in PostgreSQL

§

ExclamationMarkTildeAsterisk

!~* , a case insensitive not match regular expression operator in PostgreSQL

§

ShiftLeft

<<, a bitwise shift left operator in PostgreSQL

§

ShiftRight

>>, a bitwise shift right operator in PostgreSQL

§

Overlap

‘&&’, an overlap operator in PostgreSQL

§

ExclamationMark

Exclamation Mark ! used for PostgreSQL factorial operator

§

DoubleExclamationMark

Double Exclamation Mark !! used for PostgreSQL prefix factorial operator

§

AtSign

AtSign @ used for PostgreSQL abs operator

§

PGSquareRoot

|/, a square root math operator in PostgreSQL

§

PGCubeRoot

||/, a cube root math operator in PostgreSQL

§

Placeholder(String)

? or $ , a prepared statement arg placeholder

§

Arrow

->, used as a operator to extract json field in PostgreSQL

§

LongArrow

->>, used as a operator to extract json field as text in PostgreSQL

§

HashArrow

#> Extracts JSON sub-object at the specified path

§

HashLongArrow

#>> Extracts JSON sub-object at the specified path as text

§

AtArrow

jsonb @> jsonb -> boolean: Test whether left json contains the right json

§

ArrowAt

jsonb <@ jsonb -> boolean: Test whether right json contains the left json

§

HashMinus

jsonb #- text[] -> jsonb: Deletes the field or array element at the specified path, where path elements can be either field keys or array indexes.

§

AtQuestion

jsonb @? jsonpath -> boolean: Does JSON path return any item for the specified JSON value?

§

AtAt

jsonb @@ jsonpath → boolean: Returns the result of a JSON path predicate check for the specified JSON value. Only the first item of the result is taken into account. If the result is not Boolean, then NULL is returned.

Implementations§

§

impl Token

pub fn make_keyword(keyword: &str) -> Token

pub fn make_word(word: &str, quote_style: Option<char>) -> Token

Trait Implementations§

§

impl Clone for Token

§

fn clone(&self) -> Token

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Token

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for Token

§

fn deserialize<__D>( __deserializer: __D ) -> Result<Token, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for Token

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Hash for Token

§

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Ord for Token

§

fn cmp(&self, other: &Token) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
§

impl PartialEq<Token> for TokenWithLocation

§

fn eq(&self, other: &Token) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<TokenWithLocation> for Token

§

fn eq(&self, other: &TokenWithLocation) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for Token

§

fn eq(&self, other: &Token) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd for Token

§

fn partial_cmp(&self, other: &Token) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl Serialize for Token

§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for Token

§

impl StructuralEq for Token

§

impl StructuralPartialEq for Token

Auto Trait Implementations§

§

impl RefUnwindSafe for Token

§

impl Send for Token

§

impl Sync for Token

§

impl Unpin for Token

§

impl UnwindSafe for Token

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,