[][src]Enum mysqldump_mutator::Token

pub enum Token {
    Word(Word),
    Number(String),
    Char(char),
    SingleQuotedString(String),
    NationalStringLiteral(String),
    HexStringLiteral(String),
    Comma,
    Whitespace(Whitespace),
    Eq,
    Neq([char; 2]),
    Lt,
    Gt,
    LtEq,
    GtEq,
    Plus,
    Minus,
    Mult,
    Div,
    Mod,
    LParen,
    RParen,
    Period,
    Colon,
    DoubleColon,
    SemiColon,
    Backslash,
    LBracket,
    RBracket,
    Ampersand,
    LBrace,
    RBrace,
}

SQL Token enumeration

Variants

Word(Word)

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

Number(String)

An unsigned numeric literal

Char(char)

A character that could not be tokenized

SingleQuotedString(String)

Single quoted string: i.e: 'string'

NationalStringLiteral(String)

"National" string literal: i.e: N'string'

HexStringLiteral(String)

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

Comma

Comma

Whitespace(Whitespace)

Whitespace (space, tab, etc)

Eq

Equality operator =

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

Lt

Less Than operator <

Gt

Greater han operator >

LtEq

Less Than Or Equals operator <=

GtEq

Greater Than Or Equals operator >=

Plus

Plus operator +

Minus

Minus operator -

Mult

Multiplication operator *

Div

Division operator /

Mod

Modulo Operator %

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)

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 &

LBrace

Left brace {

RBrace

Right brace }

Methods

impl Token[src]

pub fn new(word: &str, quote_style: Option<char>) -> Self[src]

Creates a new token. quote style is None for integers.

pub fn get_value(&self) -> String[src]

Gets the value of the column encoded in an string. For numbers use get_number

pub fn get_number(&self) -> Option<f64>[src]

If the token contains a number and it can be parsed, returns Some(number). None if not.

pub fn is_keyword(&self) -> bool[src]

returns if the Token contains a keyword

pub fn get_quote_style(&self) -> Option<char>[src]

gets the quote style. None if none or it doesn't apply

Trait Implementations

impl Clone for Token[src]

impl Debug for Token[src]

impl Display for Token[src]

impl From<Token> for String[src]

impl PartialEq<Token> for Token[src]

impl StructuralPartialEq for Token[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.