Skip to main content

SelectBuilder

Type Alias SelectBuilder 

Source
pub type SelectBuilder<'a, Schema, State, Table = (), Marker = (), Row = (), Grouped = ()> = QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>;
Expand description

A SELECT query being built for SQLite.

This is QueryBuilder in one of the Select* states. Start it with QueryBuilder::select or select_distinct, then call from.

§Clause order

Clauses must be added in SQL order. Each method is only available in the states listed here:

AfterYou can call
selectfrom
fromjoins, where, group_by, order_by, limit, offset, set operations
a joinmore joins, where, group_by, order_by, limit, set operations
wheregroup_by, order_by, limit, set operations
group_byhaving, order_by, limit, set operations
havinghaving, order_by, limit, set operations
order_bylimit, set operations
limitoffset, set operations
offsetset operations
a set operationmore set operations, order_by, limit, offset

offset without limit is only offered right after from or a set operation; elsewhere, add a limit first. Every state after from can be executed, used as a subquery, or named as a derived table with alias. Every state except a compound query can become a CTE with into_cte.

§Examples

use drizzle::sqlite::prelude::*;
use drizzle::sqlite::builder::QueryBuilder;

#[SQLiteTable(name = "users")]
struct User {
    #[column(primary)]
    id: i32,
    name: String,
    email: Option<String>,
}

#[derive(SQLiteSchema)]
struct Schema {
    user: User,
}

let builder = QueryBuilder::new::<Schema>();
let Schema { user } = Schema::new();

// Basic SELECT
let query = builder.select(user.name).from(user);
assert_eq!(query.to_sql().sql(), r#"SELECT "users"."name" FROM "users""#);

// SELECT with WHERE clause
use drizzle::core::expr::gt;
let query = builder
    .select((user.id, user.name))
    .from(user)
    .r#where(gt(user.id, 10));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."id", "users"."name" FROM "users" WHERE "users"."id" > ?"#
);

Joins:

let query = builder
    .select((user.name, post.title))
    .from(user)
    .join((post, eq(user.id, post.user_id)));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."name", "posts"."title" FROM "users" JOIN "posts" ON "users"."id" = "posts"."user_id""#
);

Ordering and pagination:

let query = builder
    .select(user.name)
    .from(user)
    .order_by(asc(user.name))
    .limit(10)
    .offset(20);
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."name" FROM "users" ORDER BY "users"."name" ASC LIMIT 10 OFFSET 20"#
);

§Compile-time checks

A clause added out of order does not compile:

ⓘ
// WHERE cannot follow LIMIT.
let query = builder.select(user.name).from(user).limit(10).r#where(gt(user.id, 1));

having needs a group_by first, and a WHERE or HAVING condition must be a boolean expression. Column references are scope-checked: a query that names a table missing from its FROM and JOIN clauses is rejected when it is executed (.all(), .get(), …), used as a derived table, or used as an INSERT source.

Aliased Type§

pub struct SelectBuilder<'a, Schema, State, Table = (), Marker = (), Row = (), Grouped = ()> {
    pub sql: SQL<'a, SQLiteValue<'a>>,
    /* private fields */
}

Fields§

§sql: SQL<'a, SQLiteValue<'a>>

The SQL built so far.

Implementations§

Source§

impl<'a, S, M> SelectBuilder<'a, S, SelectInitial, (), M>

Source

pub fn from<T>( self, query: T, ) -> SelectBuilder<'a, S, SelectFromSet, T, FromMarker<M, T>, <M as ResolveRow<T>>::Row>
where T: ToSQL<'a, SQLiteValue<'a>> + ScopeEntry, M: ResolveRow<T>,

Sets the FROM source: a table, a CTE, or a derived table made with alias.

The result row type is inferred from the selected columns and this source. With select(()), the row is the table’s generated select model.

§Examples
// Select from a table
let query = builder.select(user.name).from(user);
assert_eq!(query.to_sql().sql(), r#"SELECT "users"."name" FROM "users""#);
Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: ClauseAllowed<Join>,

Source

pub fn join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, InnerJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, InnerJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, InnerJoin, J::OnSources>,

Adds a JOIN (an inner join).

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. A derived table (see alias) also works in the tuple form.

The other join methods (left_join, right_join, full_join, inner_join, the _outer and natural_ variants, and cross_join) take the same arguments. After a LEFT, RIGHT or FULL join, selected columns of the side that may be missing decode as Option; with select(()), that side’s whole model is an Option in the row.

The condition may only read tables already in the query; this is checked when the query is executed.

§Examples
let query = builder
    .select((user.name, post.title))
    .from(user)
    .join((post, eq(user.id, post.user_id)));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."name", "posts"."title" FROM "users" JOIN "posts" ON "users"."id" = "posts"."user_id""#
);
Source

pub fn natural_join<J: JoinSource<'a>>( self, source: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, InnerJoin>>::Marker, <M as JoinStep<R, J::JoinedTable, InnerJoin>>::Row, G>
where M: JoinStep<R, J::JoinedTable, InnerJoin>,

Adds a natural join (NATURAL).

A natural join matches the columns both sides share by name, so it takes a table or derived table and no ON condition.

Source

pub fn natural_left_join<J: JoinSource<'a>>( self, source: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, LeftJoin>>::Marker, <M as JoinStep<R, J::JoinedTable, LeftJoin>>::Row, G>
where M: JoinStep<R, J::JoinedTable, LeftJoin>,

Adds a natural_left join (NATURAL).

A natural join matches the columns both sides share by name, so it takes a table or derived table and no ON condition.

Source

pub fn left_join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, LeftJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, LeftJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, LeftJoin, J::OnSources>,

Adds a left join.

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. See join for an example.

Source

pub fn left_outer_join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, LeftJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, LeftJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, LeftJoin, J::OnSources>,

Adds a left_outer join.

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. See join for an example.

Source

pub fn natural_left_outer_join<J: JoinSource<'a>>( self, source: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, LeftJoin>>::Marker, <M as JoinStep<R, J::JoinedTable, LeftJoin>>::Row, G>
where M: JoinStep<R, J::JoinedTable, LeftJoin>,

Adds a natural_left_outer join (NATURAL).

A natural join matches the columns both sides share by name, so it takes a table or derived table and no ON condition.

Source

pub fn natural_right_join<J: JoinSource<'a>>( self, source: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, RightJoin>>::Marker, <M as JoinStep<R, J::JoinedTable, RightJoin>>::Row, G>
where M: JoinStep<R, J::JoinedTable, RightJoin>,

Adds a natural_right join (NATURAL).

A natural join matches the columns both sides share by name, so it takes a table or derived table and no ON condition.

Source

pub fn right_join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, RightJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, RightJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, RightJoin, J::OnSources>,

Adds a right join.

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. See join for an example.

Source

pub fn right_outer_join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, RightJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, RightJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, RightJoin, J::OnSources>,

Adds a right_outer join.

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. See join for an example.

Source

pub fn natural_right_outer_join<J: JoinSource<'a>>( self, source: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, RightJoin>>::Marker, <M as JoinStep<R, J::JoinedTable, RightJoin>>::Row, G>
where M: JoinStep<R, J::JoinedTable, RightJoin>,

Adds a natural_right_outer join (NATURAL).

A natural join matches the columns both sides share by name, so it takes a table or derived table and no ON condition.

Source

pub fn natural_full_join<J: JoinSource<'a>>( self, source: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, FullJoin>>::Marker, <M as JoinStep<R, J::JoinedTable, FullJoin>>::Row, G>
where M: JoinStep<R, J::JoinedTable, FullJoin>,

Adds a natural_full join (NATURAL).

A natural join matches the columns both sides share by name, so it takes a table or derived table and no ON condition.

Source

pub fn full_join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, FullJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, FullJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, FullJoin, J::OnSources>,

Adds a full join.

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. See join for an example.

Source

pub fn full_outer_join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, FullJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, FullJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, FullJoin, J::OnSources>,

Adds a full_outer join.

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. See join for an example.

Source

pub fn natural_full_outer_join<J: JoinSource<'a>>( self, source: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, FullJoin>>::Marker, <M as JoinStep<R, J::JoinedTable, FullJoin>>::Row, G>
where M: JoinStep<R, J::JoinedTable, FullJoin>,

Adds a natural_full_outer join (NATURAL).

A natural join matches the columns both sides share by name, so it takes a table or derived table and no ON condition.

Source

pub fn inner_join<J: JoinArg<'a, T, Via>, Via>( self, arg: J, ) -> SelectBuilder<'a, S, SelectJoinSet, J::JoinedTable, <M as JoinStep<R, J::JoinedTable, InnerJoin, J::OnSources>>::Marker, <M as JoinStep<R, J::JoinedTable, InnerJoin, J::OnSources>>::Row, G>
where M: JoinStep<R, J::JoinedTable, InnerJoin, J::OnSources>,

Adds a inner join.

Pass (table, condition) for an explicit ON condition, or a bare table to join on its foreign key to the previous table. See join for an example.

Source

pub fn cross_join<Arg: CrossJoinArg<'a, T>>( self, arg: Arg, ) -> SelectBuilder<'a, S, SelectJoinSet, Arg::JoinedTable, <M as JoinStep<R, Arg::JoinedTable, InnerJoin, Arg::OnSources>>::Marker, <M as JoinStep<R, Arg::JoinedTable, InnerJoin, Arg::OnSources>>::Row, G>
where M: JoinStep<R, Arg::JoinedTable, InnerJoin, Arg::OnSources>,

Adds a CROSS JOIN, which pairs every row with every row of arg.

A bare table renders CROSS JOIN. For backwards compatibility, (table, condition) renders the equivalent INNER JOIN ... ON ....

Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: SelectClause<Where>,

Source

pub fn where<E>( self, condition: E, ) -> SelectBuilder<'a, S, SelectWhereSet, T, <M as HasScope>::With<E::Sources>, R, G>
where M: HasScope, E: Expr<'a, SQLiteValue<'a>>, E::SQLType: BooleanLike,

Adds a WHERE clause.

The condition must be a boolean expression. Combine conditions with and and or from drizzle_core::expr.

§Examples
// Single condition
let query = builder
    .select(user.name)
    .from(user)
    .r#where(gt(user.id, 10));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."name" FROM "users" WHERE "users"."id" > ?"#
);

// Multiple conditions
let query = builder
    .select(user.name)
    .from(user)
    .r#where(and(gt(user.id, 10), eq(user.name, "Alice")));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."name" FROM "users" WHERE ("users"."id" > ? AND "users"."name" = ?)"#
);
Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: ClauseAllowed<GroupBy>,

Source

pub fn group_by<Gr>( self, columns: Gr, ) -> SelectBuilder<'a, S, SelectGroupSet, T, <M as HasScope>::With<Gr::Sources>, R, Gr::Columns>
where M: HasScope, Gr: IntoGroupBy<'a, SQLiteValue<'a>>,

Adds a GROUP BY clause. Pass one expression or a tuple.

Every selected column that is not inside an aggregate must appear in the GROUP BY list; this is checked when the query is executed. One exception: grouping by a table’s single-column primary key determines the whole row, so any column of that table may be selected. Prefer .group_by(table.pk) over listing every selected column; it also lets SQLite read groups in key order instead of sorting them in a temporary B-tree.

§Examples
let query = builder
    .select((post.user_id, count(post.id)))
    .from(post)
    .group_by(post.user_id)
    .having(gt(count(post.id), 5));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "posts"."user_id", COUNT ("posts"."id") FROM "posts" GROUP BY "posts"."user_id" HAVING COUNT ("posts"."id")> ?"#
);
Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: ClauseAllowed<Having>,

Source

pub fn having<E>( self, condition: E, ) -> SelectBuilder<'a, S, SelectGroupSet, T, <M as HasScope>::With<E::Sources>, R, G>
where M: HasScope, E: Expr<'a, SQLiteValue<'a>>, E::SQLType: BooleanLike,

Adds a HAVING clause, which filters groups.

Only available after group_by. The condition must be a boolean expression and may use aggregates. See group_by for an example.

Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: SelectClause<OrderBy>,

Source

pub fn order_by<TOrderBy>( self, expressions: TOrderBy, ) -> SelectBuilder<'a, S, SelectOrderSet, T, <M as HasScope>::With<TOrderBy::Sources>, R, G>
where M: HasScope, TOrderBy: ToSQL<'a, SQLiteValue<'a>> + ExprSources,

Adds an ORDER BY clause.

Pass one ordering term or a tuple. Wrap a column in asc or desc to set the direction.

§Examples
let query = builder
    .select(user.name)
    .from(user)
    .order_by((desc(user.name), asc(user.id)));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."name" FROM "users" ORDER BY "users"."name" DESC, "users"."id" ASC"#
);
Source§

impl<'a, S, T, M, R, G> SelectBuilder<'a, S, SelectSetOpSet, T, M, R, G>

Source

pub fn order_by<TOrderBy>( self, expressions: TOrderBy, ) -> SelectBuilder<'a, S, SelectOrderSet, T, M, R, G>
where TOrderBy: ToSQL<'a, SQLiteValue<'a>>,

Sorts a compound (UNION / INTERSECT / EXCEPT) result by its output columns.

Column references are written without their table name, because the combined rows no longer belong to one table (turso rejects the qualified form). See union for an example.

Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: ClauseAllowed<Limit>,

Source

pub fn limit<P>( self, limit: P, ) -> SelectBuilder<'a, S, SelectLimitSet, T, M, R, G>
where P: PaginationArg<'a, SQLiteValue<'a>>,

Adds a LIMIT clause.

Pass a non-negative integer, which is written into the SQL, or an integer placeholder, which is bound when the query runs. See SelectBuilder for an example.

§Panics

Panics when a signed numeric argument is negative or a numeric value does not fit in usize.

Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: ClauseAllowed<StandaloneOffset>,

Source

pub fn offset<P>( self, offset: P, ) -> SelectBuilder<'a, S, SelectOffsetSet, T, M, R, G>
where P: PaginationArg<'a, SQLiteValue<'a>>,

Skips the first offset rows without limiting the row count.

SQLite only accepts OFFSET after a LIMIT, so this renders LIMIT -1 OFFSET n; a negative limit means no limit. Only available right after from or a set operation; elsewhere call limit first.

§Examples
let query = builder.select(user.name).from(user).offset(5);
assert_eq!(query.to_sql().sql(), r#"SELECT "users"."name" FROM "users" LIMIT -1 OFFSET 5"#);
§Panics

Panics when a signed numeric argument is negative or a numeric value does not fit in usize.

Source§

impl<'a, S, T, M, R, G> SelectBuilder<'a, S, SelectLimitSet, T, M, R, G>

Source

pub fn offset<P>( self, offset: P, ) -> SelectBuilder<'a, S, SelectOffsetSet, T, M, R, G>
where P: PaginationArg<'a, SQLiteValue<'a>>,

Adds an OFFSET clause after LIMIT.

§Panics

Panics when a signed numeric argument is negative or a numeric value does not fit in usize.

Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: ClauseAllowed<Source>, M: DerivedSelection<'a, SQLiteValue<'a>, SQLiteSchemaType, T>,

Source

pub fn alias<Name, AggProof>( self, _name: Name, ) -> Derived<'a, SQLiteValue<'a>, Name, <M as DerivedSelection<'a, SQLiteValue<'a>, SQLiteSchemaType, T>>::Projection, Self>
where Name: Tag, <M as DerivedSelection<'a, SQLiteValue<'a>, SQLiteSchemaType, T>>::Projection: DerivedProjection<Name>, M: MarkerAggValidFor<G, AggProof>,

Names this query so it can be used as a derived table in from or a join.

name is a value of a Tag type; its NAME becomes the SQL alias. The result exposes the selected columns, so the outer query can reference them with typed accessors.

§Panics

Panics when the projection contains duplicate output names. Name a computed expression with drizzle_core::expr::AliasExt::named to make each output unique.

Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>

Source

pub fn into_cte<Tag: Tag + 'static>( self, ) -> CTEView<'a, <T as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Aliased<Tag>, Self>

Turns this SELECT into a common table expression named Tag::NAME.

The result derefs to an aliased copy of the FROM table, so you can select its columns with the usual field access. Pass it to QueryBuilder::with and then use it in from. Not available on a compound query (after a set operation). See QueryBuilder::with for an example.

Source§

impl<'a, S, State, T, M, R, G> SelectBuilder<'a, S, State, T, M, R, G>
where State: ClauseAllowed<Compound>,

Source

pub fn union<M2>( self, other: impl IntoSelect<'a, S, M2, R>, ) -> SelectBuilder<'a, S, SelectSetOpSet, T, <M as SetOperand<M2>>::Combined, R, G>
where M: SetOperand<M2>,

Combines this query with other using UNION, which drops duplicate rows.

Both queries must select the same row type. After a set operation you can chain more set operations, then order_by, limit and offset for the combined result.

§Examples
let query = builder
    .select(user.name)
    .from(user)
    .r#where(eq(user.id, 1))
    .union(builder.select(user.name).from(user).r#where(gt(user.id, 100)))
    .order_by(asc(user.name));
assert_eq!(
    query.to_sql().sql(),
    r#"SELECT "users"."name" FROM "users" WHERE "users"."id" = ? UNION SELECT "users"."name" FROM "users" WHERE "users"."id" > ? ORDER BY "name" ASC"#
);
Source

pub fn union_all<M2>( self, other: impl IntoSelect<'a, S, M2, R>, ) -> SelectBuilder<'a, S, SelectSetOpSet, T, <M as SetOperand<M2>>::Combined, R, G>
where M: SetOperand<M2>,

Combines this query with other using UNION ALL, which keeps duplicate rows. See union.

Source

pub fn intersect<M2>( self, other: impl IntoSelect<'a, S, M2, R>, ) -> SelectBuilder<'a, S, SelectSetOpSet, T, <M as SetOperand<M2>>::Combined, R, G>
where M: SetOperand<M2>,

Keeps only rows that other also returns (INTERSECT). See union.

Source

pub fn except<M2>( self, other: impl IntoSelect<'a, S, M2, R>, ) -> SelectBuilder<'a, S, SelectSetOpSet, T, <M as SetOperand<M2>>::Combined, R, G>
where M: SetOperand<M2>,

Keeps only rows that other does not return (EXCEPT). See union.

Trait Implementations§

Source§

impl<'a, S, State, T, M, R, G> Expr<'a, SQLiteValue<'a>> for SelectBuilder<'a, S, State, T, M, R, G>

Source§

type SQLType = <M as SubqueryType<'a, SQLiteValue<'a>>>::SQLType

The SQL data type this expression evaluates to.
Source§

type Nullable = Null

Whether this expression can be NULL.
Source§

type Aggregate = Scalar

Whether this is an aggregate (COUNT, SUM) or scalar expression.
Source§

fn to_expr_sql(&self) -> SQL<'a, V>

Renders this value as a scalar expression, borrowing it. Read more
Source§

fn into_expr_sql(self) -> SQL<'a, V>
where Self: Sized,

Renders this value as a scalar expression, consuming it.
Source§

fn to_condition_sql(&self) -> Option<SQL<'a, V>>

Renders this value as one element of a ConditionList. Read more
Source§

fn into_condition_sql(self) -> Option<SQL<'a, V>>
where Self: Sized,

Consuming counterpart of Expr::to_condition_sql.
Source§

impl<S, State, T, M, R, G> ExprSources for SelectBuilder<'_, S, State, T, M, R, G>
where M: SelectSources,

Source§

type Sources = <M as SelectSources>::Sources

Type-level tree with one Src leaf per column read.
Source§

impl<'a, S, State: ClauseAllowed<Compound>, T, M, R, G> IntoSelect<'a, S, M, R> for SelectBuilder<'a, S, State, T, M, R, G>

Source§

type State = State

Builder state of the converted query.
Source§

type Table = T

FROM table of the converted query.
Source§

fn into_select(self) -> SelectBuilder<'a, S, State, T, M, R>

Returns the underlying SelectBuilder.
Source§

impl<S, State: ClauseAllowed<Source>, T, M, R, G> SelectQuery for SelectBuilder<'_, S, State, T, M, R, G>