pub struct SelectStmt {
pub distinct: bool,
pub distinct_on: Vec<Expr>,
pub columns: Vec<SelectColumn>,
pub from: Option<FromClause>,
pub joins: Vec<Join>,
pub where_: Option<Expr>,
pub order_by: Vec<OrderBy>,
pub limit: Option<Expr>,
pub offset: Option<Expr>,
}Expand description
A SELECT statement.
Fields§
§distinct: boolWhether to use DISTINCT (eliminates duplicate rows).
distinct_on: Vec<Expr>DISTINCT ON columns (PostgreSQL-specific, returns first row of each group).
columns: Vec<SelectColumn>Columns to select (empty means SELECT *).
from: Option<FromClause>The FROM clause specifying the primary table.
joins: Vec<Join>JOIN clauses for related tables.
where_: Option<Expr>The WHERE clause filter condition.
order_by: Vec<OrderBy>ORDER BY clauses for sorting results.
limit: Option<Expr>LIMIT clause to restrict number of rows.
offset: Option<Expr>OFFSET clause for pagination.
Implementations§
Source§impl SelectStmt
impl SelectStmt
pub fn new() -> Self
Sourcepub fn distinct_on(self, cols: impl IntoIterator<Item = Expr>) -> Self
pub fn distinct_on(self, cols: impl IntoIterator<Item = Expr>) -> Self
Set DISTINCT ON columns (PostgreSQL-specific). Returns the first row of each group defined by these columns.
pub fn column(self, col: SelectColumn) -> Self
pub fn columns(self, cols: impl IntoIterator<Item = SelectColumn>) -> Self
pub fn from(self, from: FromClause) -> Self
pub fn join(self, join: Join) -> Self
pub fn where_(self, expr: Expr) -> Self
pub fn and_where(self, expr: Expr) -> Self
pub fn order_by(self, order: OrderBy) -> Self
pub fn limit(self, expr: Expr) -> Self
pub fn offset(self, expr: Expr) -> Self
Trait Implementations§
Source§impl Clone for SelectStmt
impl Clone for SelectStmt
Source§fn clone(&self) -> SelectStmt
fn clone(&self) -> SelectStmt
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SelectStmt
impl Debug for SelectStmt
Source§impl Default for SelectStmt
impl Default for SelectStmt
Source§fn default() -> SelectStmt
fn default() -> SelectStmt
Returns the “default value” for a type. Read more
Source§impl Render for SelectStmt
impl Render for SelectStmt
Auto Trait Implementations§
impl Freeze for SelectStmt
impl RefUnwindSafe for SelectStmt
impl Send for SelectStmt
impl Sync for SelectStmt
impl Unpin for SelectStmt
impl UnsafeUnpin for SelectStmt
impl UnwindSafe for SelectStmt
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