SqlWriter

Trait SqlWriter 

Source
pub trait SqlWriter: Send {
Show 52 methods // Required method fn as_dyn(&self) -> &dyn SqlWriter; // Provided methods fn alias_declaration(&self, context: &mut Context) -> bool { ... } fn update_metadata<'s>( &'s self, out: &mut DynQuery, metadata: Cow<'s, QueryMetadata>, ) { ... } fn write_escaped( &self, _context: &mut Context, out: &mut DynQuery, value: &str, search: char, replace: &str, ) { ... } fn write_identifier_quoted( &self, context: &mut Context, out: &mut DynQuery, value: &str, ) { ... } fn write_table_ref( &self, context: &mut Context, out: &mut DynQuery, value: &TableRef, ) { ... } fn write_column_ref( &self, context: &mut Context, out: &mut DynQuery, value: &ColumnRef, ) { ... } fn write_column_overridden_type( &self, _context: &mut Context, out: &mut DynQuery, _column: &ColumnDef, types: &BTreeMap<&'static str, &'static str>, ) { ... } fn write_column_type( &self, context: &mut Context, out: &mut DynQuery, value: &Value, ) { ... } fn write_value( &self, context: &mut Context, out: &mut DynQuery, value: &Value, ) { ... } fn write_value_none(&self, context: &mut Context, out: &mut DynQuery) { ... } fn write_value_bool( &self, context: &mut Context, out: &mut DynQuery, value: bool, ) { ... } fn write_value_infinity( &self, context: &mut Context, out: &mut DynQuery, negative: bool, ) { ... } fn write_value_nan(&self, context: &mut Context, out: &mut DynQuery) { ... } fn write_value_string( &self, context: &mut Context, out: &mut DynQuery, value: &str, ) { ... } fn write_value_blob( &self, context: &mut Context, out: &mut DynQuery, value: &[u8], ) { ... } fn write_value_date( &self, context: &mut Context, out: &mut DynQuery, value: &Date, timestamp: bool, ) { ... } fn write_value_time( &self, context: &mut Context, out: &mut DynQuery, value: &Time, timestamp: bool, ) { ... } fn write_value_timestamp( &self, context: &mut Context, out: &mut DynQuery, value: &PrimitiveDateTime, ) { ... } fn write_value_timestamptz( &self, context: &mut Context, out: &mut DynQuery, value: &OffsetDateTime, ) { ... } fn value_interval_units(&self) -> &[(&str, i128)] { ... } fn write_value_interval( &self, context: &mut Context, out: &mut DynQuery, value: &Interval, ) { ... } fn write_value_uuid( &self, context: &mut Context, out: &mut DynQuery, value: &Uuid, ) { ... } fn write_value_list( &self, context: &mut Context, out: &mut DynQuery, value: Either<&Box<[Value]>, &Vec<Value>>, _ty: &Value, _elem_ty: &Value, ) { ... } fn write_value_map( &self, context: &mut Context, out: &mut DynQuery, value: &HashMap<Value, Value>, ) { ... } fn write_value_struct( &self, context: &mut Context, out: &mut DynQuery, value: &Vec<(String, Value)>, ) { ... } fn expression_unary_op_precedence(&self, value: &UnaryOpType) -> i32 { ... } fn expression_binary_op_precedence(&self, value: &BinaryOpType) -> i32 { ... } fn write_expression_operand( &self, context: &mut Context, out: &mut DynQuery, value: &Operand<'_>, ) { ... } fn write_expression_operand_question_mark( &self, _context: &mut Context, out: &mut DynQuery, ) { ... } fn write_expression_unary_op( &self, context: &mut Context, out: &mut DynQuery, value: &UnaryOp<&dyn Expression>, ) { ... } fn write_expression_binary_op( &self, context: &mut Context, out: &mut DynQuery, value: &BinaryOp<&dyn Expression, &dyn Expression>, ) { ... } fn write_expression_cast( &self, context: &mut Context, out: &mut DynQuery, expr: &dyn Expression, ty: &dyn Expression, ) { ... } fn write_expression_ordered( &self, context: &mut Context, out: &mut DynQuery, value: &Ordered<&dyn Expression>, ) { ... } fn write_join_type( &self, _context: &mut Context, out: &mut DynQuery, join_type: &JoinType, ) { ... } fn write_join( &self, context: &mut Context, out: &mut DynQuery, join: &Join<&dyn DataSet, &dyn DataSet, &dyn Expression>, ) { ... } fn write_transaction_begin(&self, out: &mut DynQuery) { ... } fn write_transaction_commit(&self, out: &mut DynQuery) { ... } fn write_transaction_rollback(&self, out: &mut DynQuery) { ... } fn write_create_schema<E>(&self, out: &mut DynQuery, if_not_exists: bool) where Self: Sized, E: Entity { ... } fn write_drop_schema<E>(&self, out: &mut DynQuery, if_exists: bool) where Self: Sized, E: Entity { ... } fn write_create_table<E>(&self, out: &mut DynQuery, if_not_exists: bool) where Self: Sized, E: Entity { ... } fn write_create_table_column_fragment( &self, context: &mut Context, out: &mut DynQuery, column: &ColumnDef, ) where Self: Sized { ... } 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 { ... } fn write_create_table_references_action( &self, _context: &mut Context, out: &mut DynQuery, action: &Action, ) { ... } fn write_column_comment_inline( &self, _context: &mut Context, _out: &mut DynQuery, _column: &ColumnDef, ) where Self: Sized { ... } fn write_column_comments_statements<E>( &self, context: &mut Context, out: &mut DynQuery, ) where Self: Sized, E: Entity { ... } fn write_drop_table<E>(&self, out: &mut DynQuery, if_exists: bool) where Self: Sized, E: Entity { ... } fn write_select<'a, Data>( &self, out: &mut DynQuery, query: &impl SelectQuery<Data>, ) where Self: Sized, Data: DataSet + 'a { ... } fn write_insert<'b, E>( &self, out: &mut DynQuery, entities: impl IntoIterator<Item = &'b E>, update: bool, ) where Self: Sized, E: Entity + 'b { ... } 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 { ... } fn write_delete<E>(&self, out: &mut DynQuery, condition: impl Expression) where Self: Sized, E: Entity { ... }
}
Expand description

Dialect printer converting semantic constructs into concrete SQL strings.

Required Methods§

Source

fn as_dyn(&self) -> &dyn SqlWriter

Provided Methods§

Source

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

Whether the current fragment context allows alias declaration.

Source

fn update_metadata<'s>( &'s self, out: &mut DynQuery, metadata: Cow<'s, QueryMetadata>, )

Source

fn write_escaped( &self, _context: &mut Context, out: &mut DynQuery, value: &str, search: char, replace: &str, )

Escape occurrences of search char with replace while copying into buffer.

Source

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

Quote identifiers (“name”) doubling inner quotes.

Source

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

Render a table reference with optional alias.

Source

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

Render a column reference optionally qualifying with schema/table.

Source

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

Render the SQL overridden type.

Source

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

Render the SQL type for a Value prototype.

Source

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

Render a concrete value (including proper quoting / escaping).

Source

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

Render NULL literal.

Source

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

Render boolean literal.

Source

fn write_value_infinity( &self, context: &mut Context, out: &mut DynQuery, negative: bool, )

Render +/- INF via CAST for dialect portability.

Source

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

Render NaN via CAST for dialect portability.

Source

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

Render and escape a string literal using single quotes.

Source

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

Render a blob literal using hex escapes.

Source

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

Render a DATE literal (optionally as part of TIMESTAMP composition).

Source

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

Render a TIME literal (optionally as part of TIMESTAMP composition).

Source

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

Render a TIMESTAMP literal.

Source

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

Render a TIMESTAMPTZ literal.

Source

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

Ordered units used to decompose intervals.

Source

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

Render INTERVAL literal using largest representative units.

Source

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

Render UUID literal.

Source

fn write_value_list( &self, context: &mut Context, out: &mut DynQuery, value: Either<&Box<[Value]>, &Vec<Value>>, _ty: &Value, _elem_ty: &Value, )

Render list/array literal.

Source

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

Render map literal.

Source

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

Render 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<'_>, )

Render an operand (literal / variable / nested expression).

Source

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

Render parameter placeholder (dialect may override).

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_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,

Emit PRIMARY KEY constraint for the CREATE TABLE query

Source

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

Emit referential action keyword.

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,

Emit COMMENT ON COLUMN statements for columns carrying comments.

Source

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

Emit DROP TABLE statement.

Source

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

Emit SELECT statement (projection, FROM, WHERE, ORDER, LIMIT).

Source

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

Emit INSERT INTO (single/multi-row) optionally with ON CONFLICT DO UPDATE.

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,

Emit ON CONFLICT DO UPDATE fragment for upsert.

Source

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

Emit DELETE statement with WHERE clause.

Implementors§