pub struct PostgresQueryBuilder;
Available on crate feature
backend-postgres
only.Expand description
Postgres query builder.
Trait Implementationsยง
sourceยงimpl Debug for PostgresQueryBuilder
impl Debug for PostgresQueryBuilder
sourceยงimpl Default for PostgresQueryBuilder
impl Default for PostgresQueryBuilder
sourceยงfn default() -> PostgresQueryBuilder
fn default() -> PostgresQueryBuilder
Returns the โdefault valueโ for a type. Read more
sourceยงimpl EscapeBuilder for PostgresQueryBuilder
impl EscapeBuilder for PostgresQueryBuilder
sourceยงfn escape_string(&self, string: &str) -> String
fn escape_string(&self, string: &str) -> String
Escape a SQL string literal
sourceยงfn unescape_string(&self, string: &str) -> String
fn unescape_string(&self, string: &str) -> String
Unescape a SQL string literal
sourceยงimpl ExtensionBuilder for PostgresQueryBuilder
impl ExtensionBuilder for PostgresQueryBuilder
sourceยงfn prepare_extension_create_statement(
&self,
create: &ExtensionCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_extension_create_statement( &self, create: &ExtensionCreateStatement, sql: &mut dyn SqlWriter, )
Translate
ExtensionCreateStatement
into database specific SQL statement.sourceยงfn prepare_extension_drop_statement(
&self,
drop: &ExtensionDropStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_extension_drop_statement( &self, drop: &ExtensionDropStatement, sql: &mut dyn SqlWriter, )
Translate
ExtensionDropStatement
into database specific SQL statement.sourceยงimpl ForeignKeyBuilder for PostgresQueryBuilder
impl ForeignKeyBuilder for PostgresQueryBuilder
sourceยงfn prepare_table_ref_fk_stmt(
&self,
table_ref: &TableRef,
sql: &mut dyn SqlWriter,
)
fn prepare_table_ref_fk_stmt( &self, table_ref: &TableRef, sql: &mut dyn SqlWriter, )
Translate
TableRef
into SQL statement.sourceยงfn prepare_foreign_key_create_statement(
&self,
create: &ForeignKeyCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_foreign_key_create_statement( &self, create: &ForeignKeyCreateStatement, sql: &mut dyn SqlWriter, )
Translate
ForeignKeyCreateStatement
into SQL statement.sourceยงfn prepare_foreign_key_drop_statement(
&self,
drop: &ForeignKeyDropStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_foreign_key_drop_statement( &self, drop: &ForeignKeyDropStatement, sql: &mut dyn SqlWriter, )
Translate
ForeignKeyDropStatement
into SQL statement.sourceยงfn prepare_foreign_key_action(
&self,
foreign_key_action: &ForeignKeyAction,
sql: &mut dyn SqlWriter,
)
fn prepare_foreign_key_action( &self, foreign_key_action: &ForeignKeyAction, sql: &mut dyn SqlWriter, )
Translate
ForeignKeyAction
into SQL statement.sourceยงimpl IndexBuilder for PostgresQueryBuilder
impl IndexBuilder for PostgresQueryBuilder
sourceยงfn prepare_table_index_expression(
&self,
create: &IndexCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_index_expression( &self, create: &IndexCreateStatement, sql: &mut dyn SqlWriter, )
Translate
IndexCreateStatement
into SQL expression.
This is the default implementation for PostgresQueryBuilder
and SqliteQueryBuilder
.
MysqlQueryBuilder
overrides this default implementation.sourceยงfn prepare_index_create_statement(
&self,
create: &IndexCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_index_create_statement( &self, create: &IndexCreateStatement, sql: &mut dyn SqlWriter, )
Translate
IndexCreateStatement
into SQL statement.sourceยงfn prepare_table_ref_index_stmt(
&self,
table_ref: &TableRef,
sql: &mut dyn SqlWriter,
)
fn prepare_table_ref_index_stmt( &self, table_ref: &TableRef, sql: &mut dyn SqlWriter, )
Translate
TableRef
into SQL statement.sourceยงfn prepare_index_drop_statement(
&self,
drop: &IndexDropStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_index_drop_statement( &self, drop: &IndexDropStatement, sql: &mut dyn SqlWriter, )
Translate
IndexDropStatement
into SQL statement.sourceยงimpl OperLeftAssocDecider for PostgresQueryBuilder
impl OperLeftAssocDecider for PostgresQueryBuilder
fn well_known_left_associative(&self, op: &BinOper) -> bool
sourceยงimpl PrecedenceDecider for PostgresQueryBuilder
impl PrecedenceDecider for PostgresQueryBuilder
fn inner_expr_well_known_greater_precedence( &self, inner: &SimpleExpr, outer_oper: &Oper, ) -> bool
sourceยงimpl QueryBuilder for PostgresQueryBuilder
impl QueryBuilder for PostgresQueryBuilder
sourceยงfn placeholder(&self) -> (&str, bool)
fn placeholder(&self) -> (&str, bool)
The type of placeholder the builder uses for values, and whether it is numbered.
sourceยงfn prepare_simple_expr(&self, simple_expr: &SimpleExpr, sql: &mut dyn SqlWriter)
fn prepare_simple_expr(&self, simple_expr: &SimpleExpr, sql: &mut dyn SqlWriter)
Translate
SimpleExpr
into SQL statement.sourceยงfn prepare_select_distinct(
&self,
select_distinct: &SelectDistinct,
sql: &mut dyn SqlWriter,
)
fn prepare_select_distinct( &self, select_distinct: &SelectDistinct, sql: &mut dyn SqlWriter, )
Translate
SelectDistinct
into SQL statement.sourceยงfn prepare_bin_oper(&self, bin_oper: &BinOper, sql: &mut dyn SqlWriter)
fn prepare_bin_oper(&self, bin_oper: &BinOper, sql: &mut dyn SqlWriter)
Translate
BinOper
into SQL statement.sourceยงfn prepare_query_statement(
&self,
query: &SubQueryStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_query_statement( &self, query: &SubQueryStatement, sql: &mut dyn SqlWriter, )
Translate
QueryStatement
into SQL statement.fn prepare_function_name(&self, function: &Function, sql: &mut dyn SqlWriter)
sourceยงfn prepare_order_expr(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
fn prepare_order_expr(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
Translate
OrderExpr
into SQL statement.sourceยงfn prepare_value(&self, value: &Value, sql: &mut dyn SqlWriter)
fn prepare_value(&self, value: &Value, sql: &mut dyn SqlWriter)
Write
Value
into SQL statement as parameter.sourceยงfn values_list_tuple_prefix(&self) -> &str
fn values_list_tuple_prefix(&self) -> &str
Prefix for tuples in VALUES list (e.g. ROW for Mysql)
sourceยงfn prepare_insert_statement(
&self,
insert: &InsertStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_insert_statement( &self, insert: &InsertStatement, sql: &mut dyn SqlWriter, )
Translate
InsertStatement
into SQL statement.fn prepare_union_statement( &self, union_type: UnionType, select_statement: &SelectStatement, sql: &mut dyn SqlWriter, )
sourceยงfn prepare_select_statement(
&self,
select: &SelectStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_select_statement( &self, select: &SelectStatement, sql: &mut dyn SqlWriter, )
Translate
SelectStatement
into SQL statement.fn prepare_select_limit_offset( &self, select: &SelectStatement, sql: &mut dyn SqlWriter, )
sourceยงfn prepare_update_statement(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_update_statement( &self, update: &UpdateStatement, sql: &mut dyn SqlWriter, )
Translate
UpdateStatement
into SQL statement.sourceยงfn prepare_update_order_by(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_update_order_by( &self, update: &UpdateStatement, sql: &mut dyn SqlWriter, )
Translate ORDER BY expression in
UpdateStatement
.sourceยงfn prepare_update_limit(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_update_limit( &self, update: &UpdateStatement, sql: &mut dyn SqlWriter, )
Translate LIMIT expression in
UpdateStatement
.sourceยงfn prepare_delete_statement(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_delete_statement( &self, delete: &DeleteStatement, sql: &mut dyn SqlWriter, )
Translate
DeleteStatement
into SQL statement.sourceยงfn prepare_delete_order_by(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_delete_order_by( &self, delete: &DeleteStatement, sql: &mut dyn SqlWriter, )
Translate ORDER BY expression in
DeleteStatement
.sourceยงfn prepare_delete_limit(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_delete_limit( &self, delete: &DeleteStatement, sql: &mut dyn SqlWriter, )
Translate LIMIT expression in
DeleteStatement
.fn prepare_simple_expr_common( &self, simple_expr: &SimpleExpr, sql: &mut dyn SqlWriter, )
sourceยงfn prepare_case_statement(&self, stmts: &CaseStatement, sql: &mut dyn SqlWriter)
fn prepare_case_statement(&self, stmts: &CaseStatement, sql: &mut dyn SqlWriter)
Translate
CaseStatement
into SQL statement.sourceยงfn prepare_index_hints(
&self,
_select: &SelectStatement,
_sql: &mut dyn SqlWriter,
)
fn prepare_index_hints( &self, _select: &SelectStatement, _sql: &mut dyn SqlWriter, )
Translate [
IndexHint
] into SQL statement.sourceยงfn prepare_select_lock(&self, lock: &LockClause, sql: &mut dyn SqlWriter)
fn prepare_select_lock(&self, lock: &LockClause, sql: &mut dyn SqlWriter)
Translate
LockType
into SQL statement.sourceยงfn prepare_select_expr(&self, select_expr: &SelectExpr, sql: &mut dyn SqlWriter)
fn prepare_select_expr(&self, select_expr: &SelectExpr, sql: &mut dyn SqlWriter)
Translate
SelectExpr
into SQL statement.sourceยงfn prepare_join_expr(&self, join_expr: &JoinExpr, sql: &mut dyn SqlWriter)
fn prepare_join_expr(&self, join_expr: &JoinExpr, sql: &mut dyn SqlWriter)
Translate
JoinExpr
into SQL statement.fn prepare_join_table_ref(&self, join_expr: &JoinExpr, sql: &mut dyn SqlWriter)
sourceยงfn prepare_table_ref(&self, table_ref: &TableRef, sql: &mut dyn SqlWriter)
fn prepare_table_ref(&self, table_ref: &TableRef, sql: &mut dyn SqlWriter)
Translate
TableRef
into SQL statement.fn prepare_column_ref(&self, column_ref: &ColumnRef, sql: &mut dyn SqlWriter)
sourceยงfn prepare_un_oper(&self, un_oper: &UnOper, sql: &mut dyn SqlWriter)
fn prepare_un_oper(&self, un_oper: &UnOper, sql: &mut dyn SqlWriter)
Translate
UnOper
into SQL statement.fn prepare_bin_oper_common(&self, bin_oper: &BinOper, sql: &mut dyn SqlWriter)
sourceยงfn prepare_sub_query_oper(&self, oper: &SubQueryOper, sql: &mut dyn SqlWriter)
fn prepare_sub_query_oper(&self, oper: &SubQueryOper, sql: &mut dyn SqlWriter)
Translate
SubQueryOper
into SQL statement.sourceยงfn prepare_logical_chain_oper(
&self,
log_chain_oper: &LogicalChainOper,
i: usize,
length: usize,
sql: &mut dyn SqlWriter,
)
fn prepare_logical_chain_oper( &self, log_chain_oper: &LogicalChainOper, i: usize, length: usize, sql: &mut dyn SqlWriter, )
Translate
LogicalChainOper
into SQL statement.sourceยงfn prepare_function_name_common(
&self,
function: &Function,
sql: &mut dyn SqlWriter,
)
fn prepare_function_name_common( &self, function: &Function, sql: &mut dyn SqlWriter, )
Translate
Function
into SQL statement.fn prepare_function_arguments( &self, func: &FunctionCall, sql: &mut dyn SqlWriter, )
fn prepare_with_query(&self, query: &WithQuery, sql: &mut dyn SqlWriter)
fn prepare_with_clause(&self, with_clause: &WithClause, sql: &mut dyn SqlWriter)
fn prepare_with_clause_recursive_options( &self, with_clause: &WithClause, sql: &mut dyn SqlWriter, )
fn prepare_with_clause_common_tables( &self, with_clause: &WithClause, sql: &mut dyn SqlWriter, )
fn prepare_with_query_clause_common_table( &self, cte: &CommonTableExpression, sql: &mut dyn SqlWriter, )
fn prepare_with_query_clause_materialization( &self, cte: &CommonTableExpression, sql: &mut dyn SqlWriter, )
fn prepare_with_clause_start( &self, with_clause: &WithClause, sql: &mut dyn SqlWriter, )
fn prepare_insert(&self, replace: bool, sql: &mut dyn SqlWriter)
sourceยงfn prepare_join_type(&self, join_type: &JoinType, sql: &mut dyn SqlWriter)
fn prepare_join_type(&self, join_type: &JoinType, sql: &mut dyn SqlWriter)
Translate
JoinType
into SQL statement.fn prepare_join_type_common( &self, join_type: &JoinType, sql: &mut dyn SqlWriter, )
sourceยงfn prepare_join_on(&self, join_on: &JoinOn, sql: &mut dyn SqlWriter)
fn prepare_join_on(&self, join_on: &JoinOn, sql: &mut dyn SqlWriter)
Translate
JoinOn
into SQL statement.sourceยงfn prepare_order(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
fn prepare_order(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
Translate
Order
into SQL statement.sourceยงfn prepare_field_order(
&self,
order_expr: &OrderExpr,
values: &Values,
sql: &mut dyn SqlWriter,
)
fn prepare_field_order( &self, order_expr: &OrderExpr, values: &Values, sql: &mut dyn SqlWriter, )
Translate
Order::Field
into SQL statementsourceยงfn prepare_values_list(
&self,
value_tuples: &[ValueTuple],
sql: &mut dyn SqlWriter,
)
fn prepare_values_list( &self, value_tuples: &[ValueTuple], sql: &mut dyn SqlWriter, )
Translate a
&[ValueTuple]
into a VALUES list.sourceยงfn prepare_tuple(&self, exprs: &[SimpleExpr], sql: &mut dyn SqlWriter)
fn prepare_tuple(&self, exprs: &[SimpleExpr], sql: &mut dyn SqlWriter)
Translate
SimpleExpr::Tuple
into SQL statement.sourceยงfn prepare_keyword(&self, keyword: &Keyword, sql: &mut dyn SqlWriter)
fn prepare_keyword(&self, keyword: &Keyword, sql: &mut dyn SqlWriter)
Translate
Keyword
into SQL statement.sourceยงfn value_to_string(&self, v: &Value) -> String
fn value_to_string(&self, v: &Value) -> String
Convert a SQL value into syntax-specific string
fn value_to_string_common(&self, v: &Value) -> String
fn prepare_on_conflict_action_common( &self, on_conflict_action: &Option<OnConflictAction>, sql: &mut dyn SqlWriter, )
sourceยงfn insert_default_keyword(&self) -> &str
fn insert_default_keyword(&self) -> &str
The keywords for insert default row.
sourceยงfn insert_default_values(&self, num_rows: u32, sql: &mut dyn SqlWriter)
fn insert_default_values(&self, num_rows: u32, sql: &mut dyn SqlWriter)
Write insert default rows expression.
sourceยงfn prepare_constant_true(&self, sql: &mut dyn SqlWriter)
fn prepare_constant_true(&self, sql: &mut dyn SqlWriter)
Write TRUE constant
sourceยงfn prepare_constant_false(&self, sql: &mut dyn SqlWriter)
fn prepare_constant_false(&self, sql: &mut dyn SqlWriter)
Write FALSE constant
sourceยงimpl TableBuilder for PostgresQueryBuilder
impl TableBuilder for PostgresQueryBuilder
sourceยงfn prepare_column_def(&self, column_def: &ColumnDef, sql: &mut dyn SqlWriter)
fn prepare_column_def(&self, column_def: &ColumnDef, sql: &mut dyn SqlWriter)
Translate
ColumnDef
into SQL statement.sourceยงfn prepare_column_type(&self, column_type: &ColumnType, sql: &mut dyn SqlWriter)
fn prepare_column_type(&self, column_type: &ColumnType, sql: &mut dyn SqlWriter)
Translate
ColumnType
into SQL statement.sourceยงfn column_spec_auto_increment_keyword(&self) -> &str
fn column_spec_auto_increment_keyword(&self) -> &str
The keyword for setting a column to be auto increment.
sourceยงfn prepare_table_alter_statement(
&self,
alter: &TableAlterStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_alter_statement( &self, alter: &TableAlterStatement, sql: &mut dyn SqlWriter, )
Translate
TableAlterStatement
into SQL statement.sourceยงfn prepare_table_rename_statement(
&self,
rename: &TableRenameStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_rename_statement( &self, rename: &TableRenameStatement, sql: &mut dyn SqlWriter, )
Translate
TableRenameStatement
into SQL statement.sourceยงfn prepare_table_create_statement(
&self,
create: &TableCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_create_statement( &self, create: &TableCreateStatement, sql: &mut dyn SqlWriter, )
Translate
TableCreateStatement
into SQL statement.sourceยงfn prepare_table_ref_table_stmt(
&self,
table_ref: &TableRef,
sql: &mut dyn SqlWriter,
)
fn prepare_table_ref_table_stmt( &self, table_ref: &TableRef, sql: &mut dyn SqlWriter, )
Translate
TableRef
into SQL statement.sourceยงfn prepare_column_def_internal(
&self,
_is_alter_column: bool,
column_def: &ColumnDef,
sql: &mut dyn SqlWriter,
)
fn prepare_column_def_internal( &self, _is_alter_column: bool, column_def: &ColumnDef, sql: &mut dyn SqlWriter, )
Translate
ColumnDef
into SQL statement.sourceยงfn prepare_column_spec(&self, column_spec: &ColumnSpec, sql: &mut dyn SqlWriter)
fn prepare_column_spec(&self, column_spec: &ColumnSpec, sql: &mut dyn SqlWriter)
Translate
ColumnSpec
into SQL statement.sourceยงfn column_comment(&self, _comment: &str, _sql: &mut dyn SqlWriter)
fn column_comment(&self, _comment: &str, _sql: &mut dyn SqlWriter)
column comment
sourceยงfn prepare_table_opt(
&self,
create: &TableCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_opt( &self, create: &TableCreateStatement, sql: &mut dyn SqlWriter, )
Translate
TableOpt
into SQL statement.sourceยงfn prepare_table_opt_def(
&self,
create: &TableCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_opt_def( &self, create: &TableCreateStatement, sql: &mut dyn SqlWriter, )
Default function
sourceยงfn prepare_table_partition(
&self,
_table_partition: &TablePartition,
_sql: &mut dyn SqlWriter,
)
fn prepare_table_partition( &self, _table_partition: &TablePartition, _sql: &mut dyn SqlWriter, )
Translate
TablePartition
into SQL statement.sourceยงfn prepare_table_drop_statement(
&self,
drop: &TableDropStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_drop_statement( &self, drop: &TableDropStatement, sql: &mut dyn SqlWriter, )
Translate
TableDropStatement
into SQL statement.sourceยงfn prepare_table_drop_opt(
&self,
drop_opt: &TableDropOpt,
sql: &mut dyn SqlWriter,
)
fn prepare_table_drop_opt( &self, drop_opt: &TableDropOpt, sql: &mut dyn SqlWriter, )
Translate
TableDropOpt
into SQL statement.sourceยงfn prepare_table_truncate_statement(
&self,
truncate: &TableTruncateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_table_truncate_statement( &self, truncate: &TableTruncateStatement, sql: &mut dyn SqlWriter, )
Translate
TableTruncateStatement
into SQL statement.sourceยงfn prepare_check_constraint(&self, check: &SimpleExpr, sql: &mut dyn SqlWriter)
fn prepare_check_constraint(&self, check: &SimpleExpr, sql: &mut dyn SqlWriter)
Translate the check constraint into SQL statement
sourceยงfn prepare_generated_column(
&self,
gen: &SimpleExpr,
stored: bool,
sql: &mut dyn SqlWriter,
)
fn prepare_generated_column( &self, gen: &SimpleExpr, stored: bool, sql: &mut dyn SqlWriter, )
Translate the generated column into SQL statement
sourceยงfn prepare_create_table_if_not_exists(
&self,
create: &TableCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_create_table_if_not_exists( &self, create: &TableCreateStatement, sql: &mut dyn SqlWriter, )
Translate IF NOT EXISTS expression in
TableCreateStatement
.sourceยงimpl TypeBuilder for PostgresQueryBuilder
impl TypeBuilder for PostgresQueryBuilder
sourceยงfn prepare_type_create_statement(
&self,
create: &TypeCreateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_type_create_statement( &self, create: &TypeCreateStatement, sql: &mut dyn SqlWriter, )
Translate
TypeCreateStatement
into database specific SQL statement.sourceยงfn prepare_type_drop_statement(
&self,
drop: &TypeDropStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_type_drop_statement( &self, drop: &TypeDropStatement, sql: &mut dyn SqlWriter, )
Translate
TypeDropStatement
into database specific SQL statement.sourceยงfn prepare_type_alter_statement(
&self,
alter: &TypeAlterStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_type_alter_statement( &self, alter: &TypeAlterStatement, sql: &mut dyn SqlWriter, )
Translate
TypeAlterStatement
into database specific SQL statement.impl GenericBuilder for PostgresQueryBuilder
impl SchemaBuilder for PostgresQueryBuilder
Auto Trait Implementationsยง
impl Freeze for PostgresQueryBuilder
impl RefUnwindSafe for PostgresQueryBuilder
impl Send for PostgresQueryBuilder
impl Sync for PostgresQueryBuilder
impl Unpin for PostgresQueryBuilder
impl UnwindSafe for PostgresQueryBuilder
Blanket Implementationsยง
sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more