pub trait Query: Sized {
type Wrapper<T>;
type Based: AsTable;
// Required method
fn query_with_context<T: FromQuery<Based = Self::Based>>(
self,
sql: RawSql<T>,
) -> Result<Self::Wrapper<T>>;
// Provided method
fn query<T: FromQuery<Based = Self::Based>>(
self,
) -> Result<Self::Wrapper<T>> { ... }
}Available on crate feature
utils only.Expand description
Core query execution trait. Implementors can call .query() to run SQL and retrieve results.
You generally do not implement this trait directly; use the concrete query builders
(e.g. PostQuery, AuthorQuery).
The decorator wrappers Paginated, WithTotal, and
Sorted all implement this trait by wrapping and delegating.
Required Associated Types§
Sourcetype Wrapper<T>
type Wrapper<T>
The wrapper type for query results. For most builders this is Vec<T>;
when wrapped by WithTotal it becomes Totalled<Vec<T>>.
Required Methods§
Provided Methods§
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.