pub struct Postgres { /* private fields */ }
Expand description
A visitor to generate queries for the PostgreSQL database.
The returned parameter values implement the ToSql
trait from postgres and
can be used directly with the database.
Trait Implementations§
Source§impl<'a> Renderer<'a> for Postgres
impl<'a> Renderer<'a> for Postgres
Source§const C_BACKTICK_OPEN: &'static str = "\""
const C_BACKTICK_OPEN: &'static str = "\""
Opening backtick character to surround identifiers, such as column and table names.
Source§const C_BACKTICK_CLOSE: &'static str = "\""
const C_BACKTICK_CLOSE: &'static str = "\""
Closing backtick character to surround identifiers, such as column and table names.
Source§const C_WILDCARD: &'static str = "%"
const C_WILDCARD: &'static str = "%"
Wildcard character to be used in
LIKE
queries.Source§fn build<Q>(query: Q) -> (String, Vec<Value>)
fn build<Q>(query: Q) -> (String, Vec<Value>)
Convert the given
Query
to an SQL string and a vector of parameters.
When certain parameters are replaced with the C_PARAM
character in the
query, the vector should contain the parameter value in the right position.Source§fn add_parameter(&mut self, value: Value)
fn add_parameter(&mut self, value: Value)
When called, the visitor decided to not render the parameter into the query,
replacing it with the
C_PARAM
, calling add_parameter
with the replaced value.Source§fn parameter_substitution(&mut self)
fn parameter_substitution(&mut self)
What to use to substitute a parameter in the query.
Source§fn visit_limit_and_offset(&mut self, limit: Option<u32>, offset: Option<u32>)
fn visit_limit_and_offset(&mut self, limit: Option<u32>, offset: Option<u32>)
The
LIMIT
and OFFSET
statement in the querySource§fn visit_insert(&mut self, insert: Insert<'a>)
fn visit_insert(&mut self, insert: Insert<'a>)
A walk through an
INSERT
statementSource§fn visit_delete(&mut self, delete: Delete<'a>)
fn visit_delete(&mut self, delete: Delete<'a>)
A walk through an
DELETE
statementSource§fn visit_aggregate_to_string(&mut self, value: Expression<'a>)
fn visit_aggregate_to_string(&mut self, value: Expression<'a>)
What to use to substitute a parameter in the query.
fn visit_equals(&mut self, left: Expression<'a>, right: Expression<'a>)
fn visit_not_equals(&mut self, left: Expression<'a>, right: Expression<'a>)
fn visit_json_extract(&mut self, json_extract: JsonExtract<'a>)
fn visit_json_unquote(&mut self, json_unquote: JsonUnquote<'a>)
fn visit_array_contains( &mut self, left: Expression<'a>, right: Expression<'a>, not: bool, )
fn visit_array_contained( &mut self, left: Expression<'a>, right: Expression<'a>, not: bool, )
fn visit_array_overlaps(&mut self, left: Expression<'a>, right: Expression<'a>)
fn visit_json_extract_last_array_item( &mut self, extract: JsonExtractLastArrayElem<'a>, )
fn visit_json_extract_first_array_item( &mut self, extract: JsonExtractFirstArrayElem<'a>, )
fn visit_json_type_equals( &mut self, left: Expression<'a>, json_type: JsonType<'a>, not: bool, )
fn visit_like(&mut self, left: Expression<'a>, right: Expression<'a>)
fn visit_not_like(&mut self, left: Expression<'a>, right: Expression<'a>)
Source§fn visit_ordering(&mut self, ordering: Ordering<'a>)
fn visit_ordering(&mut self, ordering: Ordering<'a>)
A visit in the
ORDER BY
section of the queryfn visit_concat(&mut self, concat: Concat<'a>)
fn visit_to_jsonb(&mut self, to_jsonb: ToJsonb<'a>)
fn visit_json_build_object(&mut self, json_build_object: JsonBuildObject<'a>)
fn visit_json_agg(&mut self, json_agg: JsonAgg<'a>)
fn visit_encode(&mut self, encode: Encode<'a>)
fn visit_join_data(&mut self, data: JoinData<'a>)
Source§fn compatibility_modifications(&self, query: Query<'a>) -> Query<'a>
fn compatibility_modifications(&self, query: Query<'a>) -> Query<'a>
A point to modify an incoming query to make it compatible with the
underlying database.
fn surround_with<F>(&mut self, begin: &str, end: &str, f: F)where
F: FnOnce(&mut Self),
fn columns_to_bracket_list(&mut self, columns: Vec<Column<'a>>)
Source§fn visit_parameterized(&mut self, value: Value)
fn visit_parameterized(&mut self, value: Value)
A visit to a value we parameterize
Source§fn visit_joins(&mut self, joins: Vec<Join<'a>>)
fn visit_joins(&mut self, joins: Vec<Join<'a>>)
The join statements in the query
fn visit_common_table_expression(&mut self, cte: CommonTableExpression<'a>)
Source§fn visit_select(&mut self, select: Select<'a>)
fn visit_select(&mut self, select: Select<'a>)
A walk through a
SELECT
statementSource§fn visit_update(&mut self, update: Update<'a>)
fn visit_update(&mut self, update: Update<'a>)
A walk through an
UPDATE
statementfn visit_upsert(&mut self, update: Update<'a>)
fn visit_update_set(&mut self, update: Update<'a>)
Source§fn delimited_identifiers(&mut self, parts: &[&str])
fn delimited_identifiers(&mut self, parts: &[&str])
A helper for delimiting an identifier, surrounding every part with
C_BACKTICK
and delimiting the values with a .
Source§fn surround_with_backticks(&mut self, part: &str)
fn surround_with_backticks(&mut self, part: &str)
A helper for delimiting a part of an identifier, surrounding it with
C_BACKTICK
Source§fn visit_query(&mut self, query: Query<'a>)
fn visit_query(&mut self, query: Query<'a>)
A walk through a complete
Query
statementSource§fn visit_columns(&mut self, columns: Vec<Expression<'a>>)
fn visit_columns(&mut self, columns: Vec<Expression<'a>>)
The selected columns
fn visit_operation(&mut self, op: SqlOp<'a>)
Source§fn visit_expression(&mut self, value: Expression<'a>)
fn visit_expression(&mut self, value: Expression<'a>)
A visit to a value used in an expression
fn visit_multiple_tuple_comparison( &mut self, left: Row<'a>, right: Values<'a>, negate: bool, )
fn visit_values(&mut self, values: Values<'a>)
Source§fn visit_table(&mut self, table: Table<'a>, include_alias: bool)
fn visit_table(&mut self, table: Table<'a>, include_alias: bool)
A database table identifier
Source§fn visit_column(&mut self, column: Column<'a>)
fn visit_column(&mut self, column: Column<'a>)
A database column identifier
Source§fn visit_conditions(&mut self, tree: ConditionTree<'a>)
fn visit_conditions(&mut self, tree: ConditionTree<'a>)
A walk through the query conditions
fn visit_greater_than(&mut self, left: Expression<'a>, right: Expression<'a>)
fn visit_greater_than_or_equals( &mut self, left: Expression<'a>, right: Expression<'a>, )
fn visit_less_than(&mut self, left: Expression<'a>, right: Expression<'a>)
fn visit_less_than_or_equals( &mut self, left: Expression<'a>, right: Expression<'a>, )
Source§fn visit_compare(&mut self, compare: Compare<'a>)
fn visit_compare(&mut self, compare: Compare<'a>)
A comparison expression
Source§fn visit_grouping(&mut self, grouping: Grouping<'a>)
fn visit_grouping(&mut self, grouping: Grouping<'a>)
A visit in the
GROUP BY
section of the queryfn visit_average(&mut self, avg: Average<'a>)
fn visit_function(&mut self, fun: Function<'a>)
fn visit_partitioning(&mut self, over: Over<'a>)
Auto Trait Implementations§
impl Freeze for Postgres
impl RefUnwindSafe for Postgres
impl Send for Postgres
impl Sync for Postgres
impl Unpin for Postgres
impl UnwindSafe for Postgres
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