Struct Postgres

Source
pub struct Postgres<'a> { /* 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> Visitor<'a> for Postgres<'a>

Source§

const C_BACKTICK: &'static str = "\""

Backtick character to surround identifiers, such as column and table names.
Source§

const C_WILDCARD: &'static str = "%"

Wildcard character to be used in LIKE queries.
Source§

fn build<Q>(query: Q) -> (String, Vec<ParameterizedValue<'a>>)
where Q: Into<Query<'a>>,

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. Read more
Source§

fn write<D: Display>(&mut self, s: D) -> Result

Write to the query.
Source§

fn add_parameter(&mut self, value: ParameterizedValue<'a>)

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) -> Result

What to use to substitute a parameter in the query.
Source§

fn visit_limit_and_offset( &mut self, limit: Option<ParameterizedValue<'a>>, offset: Option<ParameterizedValue<'a>>, ) -> Result

The LIMIT and OFFSET statement in the query
Source§

fn visit_insert(&mut self, insert: Insert<'a>) -> Result

A walk through an INSERT statement
Source§

fn visit_aggregate_to_string(&mut self, value: DatabaseValue<'a>) -> Result

What to use to substitute a parameter in the query.
Source§

fn surround_with<F>(&mut self, begin: &str, end: &str, f: F) -> Result
where F: FnOnce(&mut Self) -> Result,

Source§

fn visit_parameterized(&mut self, value: ParameterizedValue<'a>) -> Result

A visit to a value we parameterize
Source§

fn visit_joins(&mut self, joins: Vec<Join<'a>>) -> Result

The join statements in the query
Source§

fn visit_join_data(&mut self, data: JoinData<'a>) -> Result

Source§

fn visit_select(&mut self, select: Select<'a>) -> Result

A walk through a SELECT statement
Source§

fn visit_update(&mut self, update: Update<'a>) -> Result

A walk through an UPDATE statement
Source§

fn visit_delete(&mut self, delete: Delete<'a>) -> Result

A walk through an DELETE statement
Source§

fn delimited_identifiers(&mut self, parts: &[&str]) -> Result

A helper for delimiting an identifier, surrounding every part with C_BACKTICK and delimiting the values with a .
Source§

fn visit_query(&mut self, query: Query<'a>)

A walk through a complete Query statement
Source§

fn visit_union(&mut self, ua: Union<'a>) -> Result

A walk through a union of SELECT statements
Source§

fn visit_columns(&mut self, columns: Vec<DatabaseValue<'a>>) -> Result

The selected columns
Source§

fn visit_operation(&mut self, op: SqlOp<'a>) -> Result

Source§

fn visit_database_value(&mut self, value: DatabaseValue<'a>) -> Result

A visit to a value used in an expression
Source§

fn visit_table(&mut self, table: Table<'a>, include_alias: bool) -> Result

A database table identifier
Source§

fn visit_column(&mut self, column: Column<'a>) -> Result

A database column identifier
Source§

fn visit_row(&mut self, row: Row<'a>) -> Result

A row of data used as an expression
Source§

fn visit_conditions(&mut self, tree: ConditionTree<'a>) -> Result

A walk through the query conditions
Source§

fn visit_expression(&mut self, expression: Expression<'a>) -> Result

An expression that can either be a single value, a set of conditions or a comparison call
Source§

fn visit_compare(&mut self, compare: Compare<'a>) -> Result

A comparison expression
Source§

fn visit_ordering(&mut self, ordering: Ordering<'a>) -> Result

A visit in the ORDER BY section of the query
Source§

fn visit_grouping(&mut self, grouping: Grouping<'a>) -> Result

A visit in the GROUP BY section of the query
Source§

fn visit_function(&mut self, fun: Function<'a>) -> Result

Source§

fn visit_partitioning(&mut self, over: Over<'a>) -> Result

Auto Trait Implementations§

§

impl<'a> Freeze for Postgres<'a>

§

impl<'a> RefUnwindSafe for Postgres<'a>

§

impl<'a> Send for Postgres<'a>

§

impl<'a> Sync for Postgres<'a>

§

impl<'a> Unpin for Postgres<'a>

§

impl<'a> UnwindSafe for Postgres<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,