pub struct Select {
pub table: String,
pub items: Vec<SelectItem>,
pub joins: Vec<JoinClause>,
pub filter: Option<Expr>,
pub order_by: Vec<OrderBy>,
pub take: Option<i32>,
pub skip: Option<u32>,
pub group_by: Vec<ColumnMarker>,
pub distinct: Vec<String>,
pub having: Option<Expr>,
pub order_by_items: Vec<OrderByItem>,
pub order_by_exprs: Vec<(Expr, OrderDir)>,
}Expand description
SELECT query AST node.
Fields§
§table: StringTable name.
items: Vec<SelectItem>Select items (columns or computed expressions).
joins: Vec<JoinClause>JOIN clauses.
filter: Option<Expr>WHERE clause.
order_by: Vec<OrderBy>ORDER BY clauses.
take: Option<i32>Row count to return (maps to SQL LIMIT).
Positive values limit forward; negative values signal backward pagination
(callers must negate and reverse ORDER BY in application code).
The absolute value is used when building the SQL LIMIT clause.
skip: Option<u32>Row offset to skip (maps to SQL OFFSET).
group_by: Vec<ColumnMarker>GROUP BY columns.
distinct: Vec<String>Columns to deduplicate on.
Non-empty activates deduplication:
- Postgres:
SELECT DISTINCT ON (cols) - SQLite / MySQL: plain
SELECT DISTINCT
having: Option<Expr>HAVING clause (post-GROUP BY filter).
order_by_items: Vec<OrderByItem>ORDER BY items preserved in their original mixed column/expression order.
order_by_exprs: Vec<(Expr, OrderDir)>ORDER BY expression items (for aggregate functions, e.g. COUNT(*) DESC).
Implementations§
Source§impl Select
impl Select
Sourcepub fn from_table(table: impl Into<String>) -> SelectBuilder
pub fn from_table(table: impl Into<String>) -> SelectBuilder
Creates a new SELECT query builder for the given table.
Trait Implementations§
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 UnsafeUnpin 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