pub struct PostgresQueryBuilder;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§impl EscapeBuilder for PostgresQueryBuilder
impl EscapeBuilder for PostgresQueryBuilder
Source§fn needs_escape(&self, s: &str) -> bool
fn needs_escape(&self, s: &str) -> bool
Return if string literal needs to be escaped
fn write_escaped(&self, buffer: &mut impl Write, string: &str)
Source§fn escape_string(&self, string: &str) -> String
fn escape_string(&self, string: &str) -> String
Escape a SQL string literal
Source§impl OperLeftAssocDecider for PostgresQueryBuilder
impl OperLeftAssocDecider for PostgresQueryBuilder
fn well_known_left_associative(&self, op: &BinOper) -> bool
Source§impl QueryBuilder for PostgresQueryBuilder
impl QueryBuilder for PostgresQueryBuilder
Source§fn placeholder(&self) -> (&'static str, bool)
fn placeholder(&self) -> (&'static str, bool)
The type of placeholder the builder uses for values, and whether it is numbered.
Source§fn lexer_dialect(&self) -> Dialect
fn lexer_dialect(&self) -> Dialect
Whose lexical rules SQL text written for this builder follows: where
its strings, comments and markers begin and end.
Source§fn prepare_expr(
&self,
simple_expr: &Expr,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_expr( &self, simple_expr: &Expr, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
Expr into SQL statement.Source§fn prepare_select_distinct(
&self,
select_distinct: &SelectDistinct,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_select_distinct( &self, select_distinct: &SelectDistinct, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
SelectDistinct into SQL statement.fn prepare_select_into( &self, into_table: &SelectInto, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Source§fn prepare_bin_oper(
&self,
bin_oper: &BinOper,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_bin_oper( &self, bin_oper: &BinOper, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
BinOper into SQL statement.fn prepare_function_name( &self, function: &Func, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Source§fn prepare_value(
&self,
value: Value,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_value( &self, value: Value, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Write
Value into SQL statement as parameter.fn write_string_quoted(&self, string: &str, buffer: &mut impl Write)
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)
fn prepare_union_statement( &self, union_type: UnionType, select_statement: &SelectStatement, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
fn prepare_select_limit_offset( &self, select: &SelectStatement, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
fn prepare_update_join( &self, from: &[TableRef], condition: &ConditionHolder, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
fn prepare_update_from( &self, from: &[TableRef], sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
fn prepare_update_column( &self, table: &Option<Box<TableRef>>, from: &[TableRef], column: &DynIden, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
fn prepare_update_condition( &self, from: &[TableRef], condition: &ConditionHolder, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Source§fn prepare_select_lock(
&self,
lock: &LockClause,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_select_lock( &self, lock: &LockClause, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
LockType into SQL statement.Source§fn prepare_sub_query_oper(
&self,
oper: &SubQueryOper,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_sub_query_oper( &self, oper: &SubQueryOper, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
SubQueryOper into SQL statement.Source§fn prepare_query_statement(
&self,
query: &SubQueryStatement,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_query_statement( &self, query: &SubQueryStatement, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
QueryStatement into SQL statement.fn prepare_with_query_clause_materialization( &self, cte: &CommonTableExpression, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Source§fn prepare_join_type(
&self,
join_type: &JoinType,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_join_type( &self, join_type: &JoinType, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
JoinType into SQL statement.Source§fn prepare_order_expr(
&self,
order_expr: &OrderExpr,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_order_expr( &self, order_expr: &OrderExpr, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
OrderExpr into SQL statement.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: usize,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn insert_default_values( &self, num_rows: usize, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Write insert default rows expression.
Source§impl QuotedBuilder for PostgresQueryBuilder
impl QuotedBuilder for PostgresQueryBuilder
Source§impl SqlDialect for PostgresQueryBuilder
impl SqlDialect for PostgresQueryBuilder
Source§fn in_list(&self, column: Expr, values: Vec<Value>, negated: bool) -> Expr
fn in_list(&self, column: Expr, values: Vec<Value>, negated: bool) -> Expr
A long list of one type is one array parameter, so any length fits in a statement and every length shares one prepared statement.
Source§fn json_equals(&self, column: &str, value: &Value, negated: bool) -> BoundSql
fn json_equals(&self, column: &str, value: &Value, negated: bool) -> BoundSql
The json type has no = at all, so the column is read as jsonb.
Source§fn json_exists(
&self,
column: &str,
existence: JsonExistence,
target: &str,
negate: bool,
) -> Result<BoundSql, RenderError>
fn json_exists( &self, column: &str, existence: JsonExistence, target: &str, negate: bool, ) -> Result<BoundSql, RenderError>
A key is tested with ?, which also finds a string element of an
array, so the document must be an object first; a path with @? in
strict mode, where the default lax mode would look into arrays and
read a scalar as an array of one. A path the other backends cannot
express is read as the JSONPath written.
Source§fn json_set(
&self,
column: &str,
path: &[JsonPathStep],
value: &Value,
) -> BoundSql
fn json_set( &self, column: &str, path: &[JsonPathStep], value: &Value, ) -> BoundSql
jsonb_set reads an index step of an object as a key and fails the
statement on a member step of an array, so each step’s parent is
checked to be the object or array the step needs first.
Source§fn identifier_quote(&self) -> Quote
fn identifier_quote(&self) -> Quote
The quotes around an identifier.
Source§fn numbered_markers(&self) -> bool
fn numbered_markers(&self) -> bool
Whether markers are numbered (
$1). Read moreSource§fn expression(
&self,
sql: String,
values: Vec<Value>,
) -> Result<Expr, RenderError>
fn expression( &self, sql: String, values: Vec<Value>, ) -> Result<Expr, RenderError>
Source§fn inline_values(
&self,
sql: &str,
values: &[Value],
) -> Result<String, RenderError>
fn inline_values( &self, sql: &str, values: &[Value], ) -> Result<String, RenderError>
sql with values written in place of its markers, for display.Source§fn string_literal(&self, text: &str) -> String
fn string_literal(&self, text: &str) -> String
text as a quoted string literal, escaped as inline_values
writes one, for SQL that cannot bind it: DDL, or a constant an index
expression must match.Source§fn native_arrays(&self) -> bool
fn native_arrays(&self) -> bool
Whether an array column is the database’s own array type. Read more
Source§fn exact_key(&self, column: &str) -> String
fn exact_key(&self, column: &str) -> String
column as a value that compares byte for byte, whatever its
collation, so two spellings a case- or accent-insensitive collation
matches stay apart.Source§fn json_containment(
&self,
column: &str,
value: &Value,
containment: JsonContainment,
) -> BoundSql
fn json_containment( &self, column: &str, value: &Value, containment: JsonContainment, ) -> BoundSql
A JSON containment test of
column against value.Source§fn array_predicate(
&self,
column: &str,
operator: ArrayOperator,
elements: Vec<Value>,
null_allowed: bool,
) -> BoundSql
fn array_predicate( &self, column: &str, operator: ArrayOperator, elements: Vec<Value>, null_allowed: bool, ) -> BoundSql
Source§fn array_append(&self, column: &str, element: Value) -> BoundSql
fn array_append(&self, column: &str, element: Value) -> BoundSql
column with element appended; a NULL column starts a new array.Source§fn push_identifier(&self, out: &mut String, name: &str)
fn push_identifier(&self, out: &mut String, name: &str)
Append
name to out as a quoted identifier, doubling any quote inside it.Source§fn window_default(
&self,
function: &str,
column: &str,
offset: &str,
default: &str,
over: &str,
) -> String
fn window_default( &self, function: &str, column: &str, offset: &str, default: &str, over: &str, ) -> String
LAG or LEAD (function) with a default, over the window over.Source§fn open_limit(&self) -> Option<&'static str>
fn open_limit(&self) -> Option<&'static str>
The limit an offset alone takes, where the dialect has no bare
OFFSET.Source§fn limit_in_subquery(&self) -> bool
fn limit_in_subquery(&self) -> bool
Whether an
IN (..) subquery may carry a LIMIT.Source§fn groups_frames(&self) -> bool
fn groups_frames(&self) -> bool
Whether a window frame may count
GROUPS.Source§fn update_limit(&self) -> bool
fn update_limit(&self) -> bool
Whether an
UPDATE takes ORDER BY and LIMIT itself. Where it does
not, a capped update is scoped through a primary-key subquery; the
builder renders an UpdateStatement’s limit
as it is told.Source§fn limit_offset(&self, limit: Option<u64>, offset: Option<u64>) -> BoundSql
fn limit_offset(&self, limit: Option<u64>, offset: Option<u64>) -> BoundSql
A query’s
LIMIT n OFFSET ?. Read moreSource§fn literal_match(
&self,
column: &str,
literal: &str,
leading: bool,
trailing: bool,
) -> Result<BoundSql, RenderError>
fn literal_match( &self, column: &str, literal: &str, leading: bool, trailing: bool, ) -> Result<BoundSql, RenderError>
A test that
column holds the text literal, preceded by anything
when leading and followed by anything when trailing: a LIKE
pattern with the literal’s %, _ and escape character escaped.
Refused when the backend cannot test literal as it is.Source§impl TableRefBuilder for PostgresQueryBuilder
impl TableRefBuilder for PostgresQueryBuilder
Source§fn prepare_table_ref_iden(
&self,
table_ref: &TableRef,
sql: &mut impl SqlWriter,
) -> Result<(), RenderError>
fn prepare_table_ref_iden( &self, table_ref: &TableRef, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>
Translate
TableRef that without values into SQL statement.Source§fn prepare_table_name(&self, table_name: &TableName, sql: &mut impl SqlWriter)
fn prepare_table_name(&self, table_name: &TableName, sql: &mut impl SqlWriter)
Translate
TableName into an SQL statement.Source§fn prepare_schema_name(
&self,
schema_name: &SchemaName,
sql: &mut impl SqlWriter,
)
fn prepare_schema_name( &self, schema_name: &SchemaName, sql: &mut impl SqlWriter, )
Translate
SchemaName into an SQL statement.Auto Trait Implementations§
impl Forget for PostgresQueryBuilder
impl Freeze for PostgresQueryBuilder
impl Move for PostgresQueryBuilder
impl RefUnwindSafe for PostgresQueryBuilder
impl Send for PostgresQueryBuilder
impl Sync for PostgresQueryBuilder
impl Unpin for PostgresQueryBuilder
impl UnsafeUnpin 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