Skip to main content

SqlCompiler

Struct SqlCompiler 

Source
pub struct SqlCompiler<'d, D: SqlDialect> { /* private fields */ }
Expand description

Compiles a QueryBuilder or TableSchema into parameterized SQL.

Implementations§

Source§

impl<'d, D: SqlDialect> SqlCompiler<'d, D>

Source

pub fn new(dialect: &'d D) -> Self

Source

pub fn create_table(&self, schema: &TableSchema) -> String

Source

pub fn drop_table(&self, table: &str) -> String

Source

pub fn table_exists(&self, table: &str) -> (String, Vec<Value>)

Source

pub fn select(&self, qb: &QueryBuilder) -> (String, Vec<Value>)

Compile SELECT.

Source

pub fn insert( &self, table: &str, row: &[(String, Value)], ) -> (String, Vec<Value>)

Compile INSERT, returns (sql, bindings).

Source

pub fn update(&self, qb: &QueryBuilder) -> (String, Vec<Value>)

Compile UPDATE.

Source

pub fn delete(&self, qb: &QueryBuilder) -> (String, Vec<Value>)

Compile DELETE.

Source

pub fn count(&self, qb: &QueryBuilder) -> (String, Vec<Value>)

Compile COUNT.

Auto Trait Implementations§

§

impl<'d, D> Freeze for SqlCompiler<'d, D>
where &'d D: Freeze,

§

impl<'d, D> RefUnwindSafe for SqlCompiler<'d, D>

§

impl<'d, D> Send for SqlCompiler<'d, D>
where &'d D: Send,

§

impl<'d, D> Sync for SqlCompiler<'d, D>
where &'d D: Sync,

§

impl<'d, D> Unpin for SqlCompiler<'d, D>
where &'d D: Unpin,

§

impl<'d, D> UnsafeUnpin for SqlCompiler<'d, D>

§

impl<'d, D> UnwindSafe for SqlCompiler<'d, D>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.