Struct Select
pub struct Select {
pub returning: Returning,
pub source: Source,
pub filter: Filter,
}Expand description
A SELECT expression within a query body.
Represents the combination of a data source, a filter (WHERE clause), and a projection (RETURNING/SELECT list). This is the most common query body type.
At the model level, the source is a model with optional association includes. After lowering, the source becomes a table with joins.
§Examples
ⓘ
use toasty_core::stmt::{Select, Source, Filter};
use toasty_core::schema::app::ModelId;
let select = Select::new(Source::from(ModelId(0)), Filter::ALL);
assert!(select.source.is_model());Fields§
§returning: ReturningThe projection (what columns/fields to return).
source: SourceThe data source (FROM clause). At the model level this is a model
reference; at the table level this is a table with joins.
filter: FilterThe filter (WHERE clause).
Implementations§
§impl Select
impl Select
pub fn new(source: impl Into<Source>, filter: impl Into<Filter>) -> Select
pub fn new(source: impl Into<Source>, filter: impl Into<Filter>) -> Select
Creates a new Select with the given source and filter, defaulting to
a model-level returning clause with no includes.
pub fn add_filter(&mut self, filter: impl Into<Filter>)
pub fn add_filter(&mut self, filter: impl Into<Filter>)
Adds an additional filter, AND-ing it with any existing filter.
Trait Implementations§
§impl From<SourceModel> for Select
impl From<SourceModel> for Select
§fn from(value: SourceModel) -> Select
fn from(value: SourceModel) -> Select
Converts to this type from the input type.
§impl<'a, T> IntoExprTarget<'a, T> for &'a Selectwhere
T: Resolve,
impl<'a, T> IntoExprTarget<'a, T> for &'a Selectwhere
T: Resolve,
§fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
Converts
self into an ExprTarget using the provided schema.impl StructuralPartialEq for Select
Auto Trait Implementations§
impl Freeze for Select
impl RefUnwindSafe for Select
impl Send for Select
impl Sync for Select
impl Unpin for Select
impl UnwindSafe for Select
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