Skip to main content

GenericSqlWriter

Struct GenericSqlWriter 

Source
pub struct GenericSqlWriter;
Expand description

Generic SQL writer.

Implementations§

Source§

impl GenericSqlWriter

Source

pub fn new() -> Self

New generic writer.

Trait Implementations§

Source§

impl SqlWriter for GenericSqlWriter

Source§

fn as_dyn(&self) -> &dyn SqlWriter

Source§

fn is_alias_declaration(&self, context: &mut Context) -> bool

True if the current fragment context allows alias declaration.
Source§

fn write_identifier( &self, _context: &mut Context, out: &mut DynQuery, value: &str, quoted: bool, )

Write identifier.
Source§

fn write_table_ref( &self, context: &mut Context, out: &mut DynQuery, value: &TableRef, )

Write table reference.
Source§

fn write_column_ref( &self, context: &mut Context, out: &mut DynQuery, value: &ColumnRef, )

Write column reference.
Source§

fn write_column_overridden_type( &self, _context: &mut Context, out: &mut DynQuery, _column: &ColumnDef, types: &BTreeMap<&'static str, &'static str>, )

Write overridden type.
Source§

fn write_column_type( &self, context: &mut Context, out: &mut DynQuery, value: &Value, )

Write SQL type name.
Source§

fn write_value(&self, context: &mut Context, out: &mut DynQuery, value: &Value)

Write value.
Source§

fn write_value_none(&self, context: &mut Context, out: &mut DynQuery)

Write NULL.
Source§

fn write_value_bool( &self, context: &mut Context, out: &mut DynQuery, value: bool, )

Write boolean literal.
Source§

fn write_value_i8(&self, context: &mut Context, out: &mut DynQuery, value: i8)

Source§

fn write_value_i16(&self, context: &mut Context, out: &mut DynQuery, value: i16)

Source§

fn write_value_i32(&self, context: &mut Context, out: &mut DynQuery, value: i32)

Source§

fn write_value_i64(&self, context: &mut Context, out: &mut DynQuery, value: i64)

Source§

fn write_value_i128( &self, context: &mut Context, out: &mut DynQuery, value: i128, )

Source§

fn write_value_u8(&self, context: &mut Context, out: &mut DynQuery, value: u8)

Source§

fn write_value_u16(&self, context: &mut Context, out: &mut DynQuery, value: u16)

Source§

fn write_value_u32(&self, context: &mut Context, out: &mut DynQuery, value: u32)

Source§

fn write_value_u64(&self, context: &mut Context, out: &mut DynQuery, value: u64)

Source§

fn write_value_u128( &self, context: &mut Context, out: &mut DynQuery, value: u128, )

Source§

fn write_value_f32(&self, context: &mut Context, out: &mut DynQuery, value: f32)

Source§

fn write_value_f64(&self, context: &mut Context, out: &mut DynQuery, value: f64)

Source§

fn write_value_string( &self, context: &mut Context, out: &mut DynQuery, value: &str, )

Write string literal.
Source§

fn write_value_blob( &self, context: &mut Context, out: &mut DynQuery, value: &[u8], )

Write blob literal.
Source§

fn write_value_date( &self, context: &mut Context, out: &mut DynQuery, value: &Date, timestamp: bool, )

Write date literal. Read more
Source§

fn write_value_time( &self, context: &mut Context, out: &mut DynQuery, value: &Time, timestamp: bool, )

Write time literal. Read more
Source§

fn write_value_timestamp( &self, context: &mut Context, out: &mut DynQuery, value: &PrimitiveDateTime, )

Write timestamp literal.
Source§

fn write_value_timestamptz( &self, context: &mut Context, out: &mut DynQuery, value: &OffsetDateTime, )

Write timestamptz literal.
Source§

fn value_interval_units(&self) -> &[(&str, i128)]

Units used to decompose intervals (notice the decreasing order).
Source§

fn write_value_interval( &self, context: &mut Context, out: &mut DynQuery, value: &Interval, )

Write interval literal.
Source§

fn write_value_uuid( &self, context: &mut Context, out: &mut DynQuery, value: &Uuid, )

Write UUID literal.
Source§

fn write_value_list( &self, context: &mut Context, out: &mut DynQuery, value: &mut dyn Iterator<Item = &Value>, _ty: &Value, _elem_ty: &Value, )

Write list literal.
Source§

fn write_value_map( &self, context: &mut Context, out: &mut DynQuery, value: &HashMap<Value, Value>, )

Write map literal.
Source§

fn write_value_struct( &self, context: &mut Context, out: &mut DynQuery, value: &Vec<(String, Value)>, )

Write struct literal.
Source§

fn expression_unary_op_precedence(&self, value: &UnaryOpType) -> i32

Precedence table for unary operators.
Source§

fn expression_binary_op_precedence(&self, value: &BinaryOpType) -> i32

Precedence table for binary operators.
Source§

fn write_expression_operand( &self, context: &mut Context, out: &mut DynQuery, value: &Operand<'_>, )

Write operand.
Source§

fn write_expression_operand_question_mark( &self, context: &mut Context, out: &mut DynQuery, )

Render parameter placeholder (dialect may override).
Source§

fn write_expression_operand_current_timestamp_ms( &self, _context: &mut Context, out: &mut DynQuery, )

Source§

fn write_expression_unary_op( &self, context: &mut Context, out: &mut DynQuery, value: &UnaryOp<&dyn Expression>, )

Render unary operator expression.
Source§

fn write_expression_binary_op( &self, context: &mut Context, out: &mut DynQuery, value: &BinaryOp<&dyn Expression, &dyn Expression>, )

Render binary operator expression handling precedence / parenthesis.
Source§

fn write_expression_cast( &self, context: &mut Context, out: &mut DynQuery, expr: &dyn Expression, ty: &dyn Expression, )

Render casting expression
Source§

fn write_expression_ordered( &self, context: &mut Context, out: &mut DynQuery, value: &Ordered<&dyn Expression>, )

Render ordered expression inside ORDER BY.
Source§

fn write_expression_call( &self, context: &mut Context, out: &mut DynQuery, function: &str, args: &[&dyn Expression], )

Source§

fn write_expression_list( &self, context: &mut Context, out: &mut DynQuery, value: &mut dyn Iterator<Item = &dyn Expression>, )

Source§

fn write_expression_tuple( &self, context: &mut Context, out: &mut DynQuery, value: &mut dyn Iterator<Item = &dyn Expression>, )

Source§

fn write_join_type( &self, _context: &mut Context, out: &mut DynQuery, join_type: &JoinType, )

Render join keyword(s) for the given join type.
Source§

fn write_join( &self, context: &mut Context, out: &mut DynQuery, join: &Join<&dyn Dataset, &dyn Dataset, &dyn Expression>, )

Render a JOIN clause.
Source§

fn write_transaction_begin(&self, out: &mut DynQuery)

Emit BEGIN statement.
Source§

fn write_transaction_commit(&self, out: &mut DynQuery)

Emit COMMIT statement.
Source§

fn write_transaction_rollback(&self, out: &mut DynQuery)

Emit ROLLBACK statement.
Source§

fn write_create_schema<E>(&self, out: &mut DynQuery, if_not_exists: bool)
where Self: Sized, E: Entity,

Emit CREATE SCHEMA.
Source§

fn write_drop_schema<E>(&self, out: &mut DynQuery, if_exists: bool)
where Self: Sized, E: Entity,

Emit DROP SCHEMA.
Source§

fn write_create_table<E>(&self, out: &mut DynQuery, if_not_exists: bool)
where Self: Sized, E: Entity,

Emit CREATE TABLE with columns, constraints & comments.
Source§

fn write_create_table_column_fragment( &self, context: &mut Context, out: &mut DynQuery, column: &ColumnDef, )
where Self: Sized,

Emit single column definition fragment.
Source§

fn write_create_table_primary_key_fragment<'a, It>( &self, context: &mut Context, out: &mut DynQuery, primary_key: It, )
where Self: Sized, It: IntoIterator<Item = &'a ColumnDef>, It::IntoIter: Clone,

Write PRIMARY KEY constraint.
Source§

fn write_create_table_references_action( &self, _context: &mut Context, out: &mut DynQuery, action: &Action, )

Write referential action.
Source§

fn write_column_comment_inline( &self, _context: &mut Context, _out: &mut DynQuery, _column: &ColumnDef, )
where Self: Sized,

Source§

fn write_column_comments_statements<E>( &self, context: &mut Context, out: &mut DynQuery, )
where Self: Sized, E: Entity,

Write column comments.
Source§

fn write_drop_table<E>(&self, out: &mut DynQuery, if_exists: bool)
where Self: Sized, E: Entity,

Write DROP TABLE statement.
Source§

fn write_select<'a, Data>( &self, out: &mut DynQuery, query: &impl SelectQuery<Data>, )
where Self: Sized, Data: Dataset + 'a,

Write SELECT statement.
Source§

fn write_insert<'b, E>( &self, out: &mut DynQuery, entities: impl IntoIterator<Item = &'b E>, update: bool, )
where Self: Sized, E: Entity + 'b,

Write INSERT statement.
Source§

fn write_insert_update_fragment<'a, E>( &self, context: &mut Context, out: &mut DynQuery, columns: impl Iterator<Item = &'a ColumnDef> + Clone, )
where Self: Sized, E: Entity,

Write ON CONFLICT DO UPDATE fragment for upsert.
Source§

fn write_delete<E>(&self, out: &mut DynQuery, condition: impl Expression)
where Self: Sized, E: Entity,

Write DELETE statement.

Auto Trait Implementations§

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 = 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 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.