pub trait Query {
type Input<'p>: Param;
type Output: ResultSet;
// Required method
fn format_sql(&self, formatter: &mut Formatter<'_>) -> Result;
// Provided method
fn display_sql(&self) -> SqlDisplay<&Self> { ... }
}Expand description
Describes the input (parameter) and output (relation/row/tuple) types of a query, as well as its actual SQL source text.
Consult the official SQLite documentation on the supported queries for an in-depth explanation of the precise SQL understood by SQLite.
Required Associated Types§
Sourcetype Input<'p>: Param
type Input<'p>: Param
The parameter type of the query. This must be either of the following:
- a scalar (integer, floating-point number, string, blob, or null/unit);
- an ordered tuple (or tuple struct) of scalars;
- a struct with named fields of scalar type;
- a map with string-like keys and scalar values;
- or a newtype or anything that implements
Paramlike any of the items above.
The lifetime parameter allows the implementor to use a type containing references, so as to avoid allocations when binding strings and blobs.
Sourcetype Output: ResultSet
type Output: ResultSet
The result type returned by the query. This must be either of the following:
- a scalar (integer, floating-point number, string, blob, or null/unit);
- an ordered tuple (or tuple struct) of scalars;
- a struct with named fields of scalar type;
- a map with string-like keys and scalar values;
- a sequence of any of the items above;
- or a newtype or any other type that deserializes as such (via
ResultSet).
Required Methods§
Sourcefn format_sql(&self, formatter: &mut Formatter<'_>) -> Result
fn format_sql(&self, formatter: &mut Formatter<'_>) -> Result
Provides the SQL source text of the query.
Provided Methods§
Sourcefn display_sql(&self) -> SqlDisplay<&Self>
fn display_sql(&self) -> SqlDisplay<&Self>
Returns a formatter object that displays the SQL text for this query.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.