pub struct QueryBuilder<'a, Schema = (), State = (), Table = (), Marker = (), Row = (), Grouped = ()> {
pub sql: SQL<'a, SQLiteValue<'a>>,
/* private fields */
}sqlite only.Expand description
Main query builder for SQLite operations.
QueryBuilder provides a type-safe, fluent API for building SQL queries. It uses compile-time
type checking to ensure queries are valid and properly structured.
§Type Parameters
Schema: The database schema type, ensuring queries only reference valid tablesState: The current builder state, enforcing proper query construction orderTable: The table type being operated on (for single-table operations)
§Basic Usage
use drizzle::sqlite::prelude::*;
use drizzle::sqlite::builder::QueryBuilder;
#[SQLiteTable(name = "users")]
struct User {
#[column(primary)]
id: i32,
name: String,
}
#[derive(SQLiteSchema)]
struct Schema {
user: User,
}
// Create a query builder for your schema
let builder = QueryBuilder::new::<Schema>();
let Schema { user } = Schema::new();
// Build queries using the fluent API
let query = builder
.select(user.name)
.from(user);
assert_eq!(query.to_sql().sql(), r#"SELECT "users"."name" FROM "users""#);§Query Types
The builder supports all major SQL operations:
§SELECT Queries
let query = builder.select(user.name).from(user);
let query = builder.select((user.id, user.name)).from(user).r#where(gt(user.id, 10));§INSERT Queries
let query = builder
.insert(user)
.values([InsertUser::new("Alice")]);§UPDATE Queries
let query = builder
.update(user)
.set(UpdateUser::default().with_name("Bob"))
.r#where(eq(user.id, 1));§DELETE Queries
let query = builder
.delete(user)
.r#where(lt(user.id, 10));§Common Table Expressions (CTEs)
The builder supports WITH clauses for complex queries with typed field access:
// Create a CTE with typed field access using .into_cte::<Tag>()
let active_users = builder
.select((user.id, user.name))
.from(user)
.into_cte::<ActiveUsersTag>();
// Use the CTE with typed column access via Deref
let query = builder
.with(&active_users)
.select(active_users.name) // Typed field access!
.from(&active_users);
assert_eq!(
query.to_sql().sql(),
r#"WITH "active_users" AS (SELECT "users"."id", "users"."name" FROM "users") SELECT "active_users"."name" FROM "active_users""#
);Fields§
§sql: SQL<'a, SQLiteValue<'a>>Implementations§
Source§impl<'a, S, T> QueryBuilder<'a, S, DeleteInitial, T>
impl<'a, S, T> QueryBuilder<'a, S, DeleteInitial, T>
Sourcepub fn where<E>(self, condition: E) -> QueryBuilder<'a, S, DeleteWhereSet, T>
pub fn where<E>(self, condition: E) -> QueryBuilder<'a, S, DeleteWhereSet, T>
Adds a WHERE clause to specify which rows to delete.
Warning: Without a WHERE clause, ALL rows in the table will be deleted! Always use this method unless you specifically intend to truncate the entire table.
§Examples
// Delete specific row by ID
let query = builder
.delete(user)
.r#where(eq(user.id, 1));
assert_eq!(query.to_sql().sql(), r#"DELETE FROM "users" WHERE "users"."id" = ?"#);
// Delete with complex conditions
let query = builder
.delete(user)
.r#where(and(
gt(user.id, 100),
or(eq(user.name, "test"), eq(user.age, 0))
));Sourcepub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, DeleteReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
pub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, DeleteReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
Adds a RETURNING clause to the query
Source§impl<'a, S, T> QueryBuilder<'a, S, DeleteWhereSet, T>
impl<'a, S, T> QueryBuilder<'a, S, DeleteWhereSet, T>
Sourcepub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, DeleteReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
pub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, DeleteReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
Adds a RETURNING clause after WHERE
Source§impl<'a, Schema, Table> QueryBuilder<'a, Schema, InsertInitial, Table>where
Table: SQLiteTable<'a>,
impl<'a, Schema, Table> QueryBuilder<'a, Schema, InsertInitial, Table>where
Table: SQLiteTable<'a>,
Sourcepub fn value<T>(
self,
value: <Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
<Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>: SQLModel<'a, SQLiteValue<'a>>,
pub fn value<T>(
self,
value: <Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
<Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>: SQLModel<'a, SQLiteValue<'a>>,
Specifies a single row to insert into the table.
Accepts an insert value object generated by the SQLiteTable macro
(e.g., InsertUser).
Sourcepub fn values<I, T>(
self,
values: I,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
I: IntoIterator<Item = <Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>>,
<Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>: SQLModel<'a, SQLiteValue<'a>>,
pub fn values<I, T>(
self,
values: I,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
I: IntoIterator<Item = <Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>>,
<Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Insert<T>: SQLModel<'a, SQLiteValue<'a>>,
Specifies the values to insert into the table.
Accepts an iterable of insert value objects generated by the
SQLiteTable macro (e.g., InsertUser).
Sourcepub fn columns<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, Schema, InsertColumnsSet<<Columns as InsertTargetColumns<'a, SQLiteValue<'a>, Table>>::Columns>, Table>where
Columns: InsertTargetColumns<'a, SQLiteValue<'a>, Table>,
pub fn columns<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, Schema, InsertColumnsSet<<Columns as InsertTargetColumns<'a, SQLiteValue<'a>, Table>>::Columns>, Table>where
Columns: InsertTargetColumns<'a, SQLiteValue<'a>, Table>,
Chooses an explicit ordered target-column list for an INSERT SELECT.
Sourcepub fn select<Q, R, ScopeProof, AggProof>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Table: InsertSelectTable,
Q: IntoSelectQuery<'a, Schema, R>,
<Q as IntoSelectQuery<'a, Schema, R>>::Marker: InsertSelectCompatible<'a, SQLiteValue<'a>, Table, R> + InsertSourceInScope<ScopeProof> + MarkerAggValidFor<<Q as IntoSelectQuery<'a, Schema, R>>::Grouped, AggProof>,
pub fn select<Q, R, ScopeProof, AggProof>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Table: InsertSelectTable,
Q: IntoSelectQuery<'a, Schema, R>,
<Q as IntoSelectQuery<'a, Schema, R>>::Marker: InsertSelectCompatible<'a, SQLiteValue<'a>, Table, R> + InsertSourceInScope<ScopeProof> + MarkerAggValidFor<<Q as IntoSelectQuery<'a, Schema, R>>::Grouped, AggProof>,
Inserts a checked SELECT into every insertable table column.
Sourcepub fn select_raw<Q>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Q: ToSQL<'a, SQLiteValue<'a>>,
pub fn select_raw<Q>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Q: ToSQL<'a, SQLiteValue<'a>>,
Inserts an unchecked raw SELECT without a target list.
This opts out of projection shape, type, nullability, source-scope, and aggregate validation.
Source§impl<'a, Schema, Table, Targets> QueryBuilder<'a, Schema, InsertColumnsSet<Targets>, Table>where
Table: SQLiteTable<'a> + InsertSelectTable,
impl<'a, Schema, Table, Targets> QueryBuilder<'a, Schema, InsertColumnsSet<Targets>, Table>where
Table: SQLiteTable<'a> + InsertSelectTable,
Sourcepub fn select<Q, R, RequiredProof, ScopeProof, AggProof>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Targets: IncludesRequired<<Table as InsertSelectTable>::RequiredColumns, RequiredProof>,
Q: IntoSelectQuery<'a, Schema, R>,
<Q as IntoSelectQuery<'a, Schema, R>>::Marker: PartialInsertSelectCompatible<'a, SQLiteValue<'a>, Targets> + InsertSourceInScope<ScopeProof> + MarkerAggValidFor<<Q as IntoSelectQuery<'a, Schema, R>>::Grouped, AggProof>,
pub fn select<Q, R, RequiredProof, ScopeProof, AggProof>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Targets: IncludesRequired<<Table as InsertSelectTable>::RequiredColumns, RequiredProof>,
Q: IntoSelectQuery<'a, Schema, R>,
<Q as IntoSelectQuery<'a, Schema, R>>::Marker: PartialInsertSelectCompatible<'a, SQLiteValue<'a>, Targets> + InsertSourceInScope<ScopeProof> + MarkerAggValidFor<<Q as IntoSelectQuery<'a, Schema, R>>::Grouped, AggProof>,
Inserts a checked SELECT into the chosen target columns.
Sourcepub fn select_raw<Q, RequiredProof>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Targets: IncludesRequired<<Table as InsertSelectTable>::RequiredColumns, RequiredProof>,
Q: ToSQL<'a, SQLiteValue<'a>>,
pub fn select_raw<Q, RequiredProof>(
self,
query: Q,
) -> QueryBuilder<'a, Schema, InsertValuesSet, Table>where
Targets: IncludesRequired<<Table as InsertSelectTable>::RequiredColumns, RequiredProof>,
Q: ToSQL<'a, SQLiteValue<'a>>,
Inserts an unchecked raw SELECT into the chosen target columns.
This opts out of projection shape, type, nullability, source-scope, and aggregate validation.
Source§impl<'a, S, T> QueryBuilder<'a, S, InsertValuesSet, T>
impl<'a, S, T> QueryBuilder<'a, S, InsertValuesSet, T>
Sourcepub fn on_conflict<C>(
self,
target: C,
) -> OnConflictBuilder<'a, SQLiteValue<'a>, S, T, ConflictColumnsTarget<'a, SQLiteValue<'a>>, SQLiteOnConflictOutput>where
C: ConflictTarget<T>,
pub fn on_conflict<C>(
self,
target: C,
) -> OnConflictBuilder<'a, SQLiteValue<'a>, S, T, ConflictColumnsTarget<'a, SQLiteValue<'a>>, SQLiteOnConflictOutput>where
C: ConflictTarget<T>,
Begins a typed ON CONFLICT clause targeting a specific constraint.
The target must implement ConflictTarget<T>, which is auto-generated for
primary key columns, unique columns, and unique indexes.
Returns an OnConflictBuilder to specify do_nothing() or do_update().
§Examples
fn main() {
use drizzle::sqlite::prelude::*;
use drizzle::sqlite::builder::QueryBuilder;
#[SQLiteTable(name = "users")]
struct User {
#[column(primary)]
id: i32,
name: String,
#[column(unique)]
email: Option<String>,
}
#[derive(SQLiteSchema)]
struct Schema {
user: User,
}
let builder = QueryBuilder::new::<Schema>();
let schema = Schema::new();
let user = schema.user;
// Target a specific column (requires PK or unique constraint)
builder.insert(user).values([InsertUser::new("Alice")])
.on_conflict(user.id).do_nothing();
// Target with DO UPDATE
builder.insert(user).values([InsertUser::new("Alice")])
.on_conflict(user.email).do_update(UpdateUser::default().with_name("updated"));
}Sourcepub fn on_conflict_do_nothing(
self,
) -> QueryBuilder<'a, S, InsertOnConflictSet, T>
pub fn on_conflict_do_nothing( self, ) -> QueryBuilder<'a, S, InsertOnConflictSet, T>
Shorthand for ON CONFLICT DO NOTHING without specifying a target.
This matches any constraint violation.
Sourcepub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, InsertReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
pub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, InsertReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
Adds a RETURNING clause and transitions to ReturningSet state
Source§impl<'a, S, T> QueryBuilder<'a, S, InsertOnConflictSet, T>
impl<'a, S, T> QueryBuilder<'a, S, InsertOnConflictSet, T>
Sourcepub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, InsertReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
pub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, InsertReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
Adds a RETURNING clause after ON CONFLICT
Source§impl<'a, S, T> QueryBuilder<'a, S, InsertDoUpdateSet, T>
impl<'a, S, T> QueryBuilder<'a, S, InsertDoUpdateSet, T>
Sourcepub fn where<E>(
self,
condition: E,
) -> QueryBuilder<'a, S, InsertOnConflictSet, T>
pub fn where<E>( self, condition: E, ) -> QueryBuilder<'a, S, InsertOnConflictSet, T>
Adds a WHERE clause to the DO UPDATE SET clause.
Generates: ON CONFLICT (col) DO UPDATE SET ... WHERE condition
Sourcepub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, InsertReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
pub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, InsertReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
Adds a RETURNING clause after DO UPDATE SET
Source§impl<'a, S, M> QueryBuilder<'a, S, SelectInitial, (), M>
impl<'a, S, M> QueryBuilder<'a, S, SelectInitial, (), M>
Sourcepub fn from<T>(
self,
query: T,
) -> QueryBuilder<'a, S, SelectFromSet, T, Scoped<M, Cons<T, Nil>>, <M as ResolveRow<T>>::Row>
pub fn from<T>( self, query: T, ) -> QueryBuilder<'a, S, SelectFromSet, T, Scoped<M, Cons<T, Nil>>, <M as ResolveRow<T>>::Row>
Specifies the table or subquery to select FROM.
This method transitions the builder from the initial state to the FROM state, enabling subsequent WHERE, JOIN, ORDER BY, and other clauses.
The row type R is resolved from the select marker M and the table T
via the ResolveRow trait.
§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> QueryBuilder<'a, S, State, T, M, R, G>where
State: JoinAllowed,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: JoinAllowed,
Sourcepub fn join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
pub fn join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
Adds an INNER JOIN clause to the query.
Joins another table to the current query using the specified condition. The joined table must be part of the schema and the condition should relate columns from both tables.
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""#
);Sourcepub fn natural_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>
pub fn natural_join<J>( self, source: J, ) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>
Adds a NATURAL join. The database matches the columns both sides share by name, so it takes a source and no ON condition.
Sourcepub fn natural_left_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
pub fn natural_left_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
Adds a NATURAL join. The database matches the columns both sides share by name, so it takes a source and no ON condition.
pub fn left_join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterLeftJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterLeftJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
pub fn left_outer_join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterLeftJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterLeftJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
Sourcepub fn natural_left_outer_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
pub fn natural_left_outer_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterLeftJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
Adds a NATURAL join. The database matches the columns both sides share by name, so it takes a source and no ON condition.
Sourcepub fn natural_right_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
pub fn natural_right_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
Adds a NATURAL join. The database matches the columns both sides share by name, so it takes a source and no ON condition.
pub fn right_join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterRightJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterRightJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
pub fn right_outer_join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterRightJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterRightJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
Sourcepub fn natural_right_outer_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
pub fn natural_right_outer_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterRightJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
Adds a NATURAL join. The database matches the columns both sides share by name, so it takes a source and no ON condition.
Sourcepub fn natural_full_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
pub fn natural_full_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
Adds a NATURAL join. The database matches the columns both sides share by name, so it takes a source and no ON condition.
pub fn full_join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterFullJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterFullJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
pub fn full_outer_join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterFullJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterFullJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
Sourcepub fn natural_full_outer_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
pub fn natural_full_outer_join<J>(
self,
source: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinSource<'a>>::JoinedTable, <M as ScopePush<<J as JoinSource<'a>>::JoinedTable>>::Out, <M as AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable>>::NewRow, G>where
J: JoinSource<'a>,
M: AfterFullJoin<R, <J as JoinSource<'a>>::JoinedTable> + ScopePush<<J as JoinSource<'a>>::JoinedTable>,
Adds a NATURAL join. The database matches the columns both sides share by name, so it takes a source and no ON condition.
pub fn inner_join<J>(
self,
arg: J,
) -> QueryBuilder<'a, S, SelectJoinSet, <J as JoinArg<'a, T>>::JoinedTable, <M as ScopePush<<J as JoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterJoin<R, <J as JoinArg<'a, T>>::JoinedTable>>::NewRow, G>where
J: JoinArg<'a, T>,
M: AfterJoin<R, <J as JoinArg<'a, T>>::JoinedTable> + ScopePush<<J as JoinArg<'a, T>>::JoinedTable>,
Sourcepub fn cross_join<Arg>(
self,
arg: Arg,
) -> QueryBuilder<'a, S, SelectJoinSet, <Arg as CrossJoinArg<'a, T>>::JoinedTable, <M as ScopePush<<Arg as CrossJoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterJoin<R, <Arg as CrossJoinArg<'a, T>>::JoinedTable>>::NewRow, G>
pub fn cross_join<Arg>( self, arg: Arg, ) -> QueryBuilder<'a, S, SelectJoinSet, <Arg as CrossJoinArg<'a, T>>::JoinedTable, <M as ScopePush<<Arg as CrossJoinArg<'a, T>>::JoinedTable>>::Out, <M as AfterJoin<R, <Arg as CrossJoinArg<'a, T>>::JoinedTable>>::NewRow, G>
Adds a cross join.
A bare source renders CROSS JOIN. For backwards compatibility,
(source, predicate) renders the equivalent INNER JOIN ... ON ....
Source§impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: SelectWhereAllowed,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: SelectWhereAllowed,
Sourcepub fn where<E>(
self,
condition: E,
) -> QueryBuilder<'a, S, SelectWhereSet, T, M, R, G>
pub fn where<E>( self, condition: E, ) -> QueryBuilder<'a, S, SelectWhereSet, T, M, R, G>
Adds a WHERE clause to filter query results.
// 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")));Source§impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: GroupByAllowed,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: GroupByAllowed,
Sourcepub fn group_by<Gr>(
self,
columns: Gr,
) -> QueryBuilder<'a, S, SelectGroupSet, T, M, R, <Gr as IntoGroupBy<'a, SQLiteValue<'a>>>::Columns>where
Gr: IntoGroupBy<'a, SQLiteValue<'a>>,
pub fn group_by<Gr>(
self,
columns: Gr,
) -> QueryBuilder<'a, S, SelectGroupSet, T, M, R, <Gr as IntoGroupBy<'a, SQLiteValue<'a>>>::Columns>where
Gr: IntoGroupBy<'a, SQLiteValue<'a>>,
Adds a GROUP BY clause to the query.
Non-aggregate columns in SELECT must appear in the GROUP BY list, with
one exception: grouping by a table’s single-column primary key
functionally determines the whole row (SQL:1999), so any scalar column
of that table may be selected. Prefer .group_by(table.pk) over
listing every selected column — it also lets SQLite stream groups in
key order instead of sorting through a temp B-tree.
Source§impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: HavingAllowed,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: HavingAllowed,
Sourcepub fn having<E>(
self,
condition: E,
) -> QueryBuilder<'a, S, SelectGroupSet, T, M, R, G>
pub fn having<E>( self, condition: E, ) -> QueryBuilder<'a, S, SelectGroupSet, T, M, R, G>
Adds a HAVING clause after GROUP BY.
Source§impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: SelectOrderAllowed,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: SelectOrderAllowed,
Sourcepub fn order_by<TOrderBy>(
self,
expressions: TOrderBy,
) -> QueryBuilder<'a, S, SelectOrderSet, T, M, R, G>where
TOrderBy: ToSQL<'a, SQLiteValue<'a>>,
pub fn order_by<TOrderBy>(
self,
expressions: TOrderBy,
) -> QueryBuilder<'a, S, SelectOrderSet, T, M, R, G>where
TOrderBy: ToSQL<'a, SQLiteValue<'a>>,
Sorts the query results.
Source§impl<'a, S, T, M, R, G> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
impl<'a, S, T, M, R, G> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
Sourcepub fn order_by<TOrderBy>(
self,
expressions: TOrderBy,
) -> QueryBuilder<'a, S, SelectOrderSet, T, M, R, G>where
TOrderBy: ToSQL<'a, SQLiteValue<'a>>,
pub fn order_by<TOrderBy>(
self,
expressions: TOrderBy,
) -> QueryBuilder<'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 rendered unqualified, which is
the only spelling PostgreSQL and turso accept here.
Source§impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: LimitAllowed,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: LimitAllowed,
Sourcepub fn limit<P>(
self,
limit: P,
) -> QueryBuilder<'a, S, SelectLimitSet, T, M, R, G>where
P: PaginationArg<'a, SQLiteValue<'a>>,
pub fn limit<P>(
self,
limit: P,
) -> QueryBuilder<'a, S, SelectLimitSet, T, M, R, G>where
P: PaginationArg<'a, SQLiteValue<'a>>,
Limits the number of rows returned.
§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> QueryBuilder<'a, S, State, T, M, R, G>where
State: SelectStandaloneOffsetAllowed,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: SelectStandaloneOffsetAllowed,
Sourcepub fn offset<P>(
self,
offset: P,
) -> QueryBuilder<'a, S, SelectOffsetSet, T, M, R, G>where
P: PaginationArg<'a, SQLiteValue<'a>>,
pub fn offset<P>(
self,
offset: P,
) -> QueryBuilder<'a, S, SelectOffsetSet, T, M, R, G>where
P: PaginationArg<'a, SQLiteValue<'a>>,
Sets the offset for the query results.
SQLite only accepts OFFSET after a LIMIT, so this renders
LIMIT -1 OFFSET n; a negative limit means no limit.
§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> QueryBuilder<'a, S, SelectLimitSet, T, M, R, G>
impl<'a, S, T, M, R, G> QueryBuilder<'a, S, SelectLimitSet, T, M, R, G>
Sourcepub fn offset<P>(
self,
offset: P,
) -> QueryBuilder<'a, S, SelectOffsetSet, T, M, R, G>where
P: PaginationArg<'a, SQLiteValue<'a>>,
pub fn offset<P>(
self,
offset: P,
) -> QueryBuilder<'a, S, SelectOffsetSet, T, M, R, G>where
P: PaginationArg<'a, SQLiteValue<'a>>,
Sets the offset for the query results.
§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> QueryBuilder<'a, S, State, T, M, R, G>
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>
Sourcepub fn alias<Name, ScopeProof, AggProof>(
self,
_name: Name,
) -> Derived<'a, SQLiteValue<'a>, Name, <M as DerivedSelection<'a, SQLiteValue<'a>, SQLiteSchemaType, T>>::Projection, QueryBuilder<'a, S, State, T, M, R, G>>where
Name: Tag,
<M as DerivedSelection<'a, SQLiteValue<'a>, SQLiteSchemaType, T>>::Projection: DerivedProjection<Name>,
M: MarkerScopeValidFor<ScopeProof> + MarkerAggValidFor<G, AggProof>,
pub fn alias<Name, ScopeProof, AggProof>(
self,
_name: Name,
) -> Derived<'a, SQLiteValue<'a>, Name, <M as DerivedSelection<'a, SQLiteValue<'a>, SQLiteSchemaType, T>>::Projection, QueryBuilder<'a, S, State, T, M, R, G>>where
Name: Tag,
<M as DerivedSelection<'a, SQLiteValue<'a>, SQLiteSchemaType, T>>::Projection: DerivedProjection<Name>,
M: MarkerScopeValidFor<ScopeProof> + MarkerAggValidFor<G, AggProof>,
Names this completed query so it can be used as a derived source.
§Panics
Panics when the projection contains duplicate output names. Name a
computed expression with drizzle_core::expr::NamedExt::named to
make each output unique.
Source§impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>
Sourcepub fn into_cte<Tag>(
self,
) -> CTEView<'a, SQLiteValue<'a>, <T as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Aliased<Tag>, QueryBuilder<'a, S, State, T, M, R, G>>where
Tag: Tag + 'static,
pub fn into_cte<Tag>(
self,
) -> CTEView<'a, SQLiteValue<'a>, <T as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Aliased<Tag>, QueryBuilder<'a, S, State, T, M, R, G>>where
Tag: Tag + 'static,
Converts this SELECT query into a typed CTE using alias tag name.
Source§impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: ExecutableState,
impl<'a, S, State, T, M, R, G> QueryBuilder<'a, S, State, T, M, R, G>where
State: ExecutableState,
Sourcepub fn union(
self,
other: impl IntoSelect<'a, S, M, R>,
) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
pub fn union( self, other: impl IntoSelect<'a, S, M, R>, ) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
Combines this query with another using UNION.
Sourcepub fn union_all(
self,
other: impl IntoSelect<'a, S, M, R>,
) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
pub fn union_all( self, other: impl IntoSelect<'a, S, M, R>, ) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
Combines this query with another using UNION ALL.
Sourcepub fn intersect(
self,
other: impl IntoSelect<'a, S, M, R>,
) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
pub fn intersect( self, other: impl IntoSelect<'a, S, M, R>, ) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
Combines this query with another using INTERSECT.
Sourcepub fn except(
self,
other: impl IntoSelect<'a, S, M, R>,
) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
pub fn except( self, other: impl IntoSelect<'a, S, M, R>, ) -> QueryBuilder<'a, S, SelectSetOpSet, T, M, R, G>
Combines this query with another using EXCEPT.
Source§impl<'a, Schema, Table> QueryBuilder<'a, Schema, UpdateInitial, Table>where
Table: SQLiteTable<'a>,
impl<'a, Schema, Table> QueryBuilder<'a, Schema, UpdateInitial, Table>where
Table: SQLiteTable<'a>,
Sourcepub fn set(
self,
values: <Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Update,
) -> QueryBuilder<'a, Schema, UpdateSetClauseSet, Table>
pub fn set( self, values: <Table as SQLTable<'a, SQLiteSchemaType, SQLiteValue<'a>>>::Update, ) -> QueryBuilder<'a, Schema, UpdateSetClauseSet, Table>
Specifies which columns to update and their new values.
This method accepts update expressions that specify which columns should
be modified. You can update single or multiple columns using the generated
update model’s with_* setters.
§Examples
// Update single column
let query = builder
.update(user)
.set(UpdateUser::default().with_name("New Name"));
assert_eq!(query.to_sql().sql(), r#"UPDATE "users" SET "name" = ?"#);
// Update multiple columns
let query = builder
.update(user)
.set(UpdateUser::default().with_name("New Name").with_email("new@example.com"));Source§impl<'a, S, T> QueryBuilder<'a, S, UpdateSetClauseSet, T>
impl<'a, S, T> QueryBuilder<'a, S, UpdateSetClauseSet, T>
Sourcepub fn where<E>(self, condition: E) -> QueryBuilder<'a, S, UpdateWhereSet, T>
pub fn where<E>(self, condition: E) -> QueryBuilder<'a, S, UpdateWhereSet, T>
Adds a WHERE clause to specify which rows to update.
Without a WHERE clause, all rows in the table would be updated. This method allows you to specify conditions to limit which rows are affected by the update.
§Examples
// Update specific row by ID
let query = builder
.update(user)
.set(UpdateUser::default().with_name("Updated Name"))
.r#where(eq(user.id, 1));
assert_eq!(
query.to_sql().sql(),
r#"UPDATE "users" SET "name" = ? WHERE "users"."id" = ?"#
);
// Update multiple rows with complex condition
let query = builder
.update(user)
.set(UpdateUser::default().with_name("Updated"))
.r#where(and(gt(user.id, 10), eq(user.age, 25)));Sourcepub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, UpdateReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
pub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, UpdateReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
Adds a RETURNING clause and transitions to the ReturningSet state
Source§impl<'a, S, T> QueryBuilder<'a, S, UpdateWhereSet, T>
impl<'a, S, T> QueryBuilder<'a, S, UpdateWhereSet, T>
Sourcepub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, UpdateReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
pub fn returning<Columns>(
self,
columns: Columns,
) -> QueryBuilder<'a, S, UpdateReturningSet, T, Scoped<<Columns as IntoSelectTarget>::Marker, Cons<T, Nil>>, <<Columns as IntoSelectTarget>::Marker as ResolveRow<T>>::Row>where
Columns: ToSQL<'a, SQLiteValue<'a>> + IntoSelectTarget,
<Columns as IntoSelectTarget>::Marker: ResolveRow<T>,
Adds a RETURNING clause after WHERE
Source§impl<'a, Schema, State, Table, Marker, Row, Grouped> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
State: ExecutableState,
impl<'a, Schema, State, Table, Marker, Row, Grouped> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
State: ExecutableState,
Sourcepub fn comment(
self,
text: impl AsRef<str>,
) -> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
pub fn comment( self, text: impl AsRef<str>, ) -> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
Attaches a sqlcommenter comment to the query.
The comment is prepended to the generated SQL and wrapped in /* ... */.
Any /* or */ sequences in the input are sanitised so they can’t
terminate the surrounding comment.
Attaches a tag-style sqlcommenter comment to the query.
Each (key, value) pair is URL-encoded, sorted alphabetically, joined
with ,, and wrapped in /* ... */. Pairs with empty values are
skipped; an all-empty input is a no-op.
Source§impl<'a> QueryBuilder<'a>
impl<'a> QueryBuilder<'a>
Sourcepub const fn new<S>() -> QueryBuilder<'a, S, BuilderInit>
pub const fn new<S>() -> QueryBuilder<'a, S, BuilderInit>
Creates a new query builder for the given schema type.
This is the entry point for building SQL queries. The schema type parameter ensures that only valid tables from your schema can be used in queries.
§Examples
use drizzle::sqlite::prelude::*;
use drizzle::sqlite::builder::QueryBuilder;
#[SQLiteTable(name = "users")]
struct User {
#[column(primary)]
id: i32,
name: String,
}
#[derive(SQLiteSchema)]
struct MySchema {
user: User,
}
let builder = QueryBuilder::new::<MySchema>();Source§impl<'a, Schema> QueryBuilder<'a, Schema, BuilderInit>
impl<'a, Schema> QueryBuilder<'a, Schema, BuilderInit>
Sourcepub fn select<T>(
&self,
columns: T,
) -> QueryBuilder<'a, Schema, SelectInitial, (), <T as IntoSelectTarget>::Marker>
pub fn select<T>( &self, columns: T, ) -> QueryBuilder<'a, Schema, SelectInitial, (), <T as IntoSelectTarget>::Marker>
Begins a SELECT query with the specified columns.
This method starts building a SELECT statement. You can select individual columns,
multiple columns as a tuple, or use () to select all columns.
§Examples
// Select a single column
let query = builder.select(user.name).from(user);
assert_eq!(query.to_sql().sql(), r#"SELECT "users"."name" FROM "users""#);
// Select multiple columns
let query = builder.select((user.id, user.name)).from(user);
assert_eq!(query.to_sql().sql(), r#"SELECT "users"."id", "users"."name" FROM "users""#);Sourcepub fn select_distinct<T>(
&self,
columns: T,
) -> QueryBuilder<'a, Schema, SelectInitial, (), <T as IntoSelectTarget>::Marker>
pub fn select_distinct<T>( &self, columns: T, ) -> QueryBuilder<'a, Schema, SelectInitial, (), <T as IntoSelectTarget>::Marker>
Begins a SELECT DISTINCT query with the specified columns.
SELECT DISTINCT removes duplicate rows from the result set.
§Examples
let query = builder.select_distinct(user.name).from(user);
assert_eq!(query.to_sql().sql(), r#"SELECT DISTINCT "users"."name" FROM "users""#);Source§impl<'a, Schema> QueryBuilder<'a, Schema, CTEInit>
impl<'a, Schema> QueryBuilder<'a, Schema, CTEInit>
pub fn select<T>( &self, columns: T, ) -> QueryBuilder<'a, Schema, SelectInitial, (), <T as IntoSelectTarget>::Marker>
Sourcepub fn select_distinct<T>(
&self,
columns: T,
) -> QueryBuilder<'a, Schema, SelectInitial, (), <T as IntoSelectTarget>::Marker>
pub fn select_distinct<T>( &self, columns: T, ) -> QueryBuilder<'a, Schema, SelectInitial, (), <T as IntoSelectTarget>::Marker>
Begins a SELECT DISTINCT query with the specified columns after a CTE.
Sourcepub fn insert<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, InsertInitial, Table>where
Table: SQLiteTable<'a>,
pub fn insert<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, InsertInitial, Table>where
Table: SQLiteTable<'a>,
Begins an INSERT query after a CTE.
Sourcepub fn update<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, UpdateInitial, Table>where
Table: SQLiteTable<'a>,
pub fn update<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, UpdateInitial, Table>where
Table: SQLiteTable<'a>,
Begins an UPDATE query after a CTE.
Sourcepub fn delete<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, DeleteInitial, Table>where
Table: SQLiteTable<'a>,
pub fn delete<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, DeleteInitial, Table>where
Table: SQLiteTable<'a>,
Begins a DELETE query after a CTE.
pub fn with<C>(&self, cte: &C) -> QueryBuilder<'a, Schema, CTEInit>where
C: CTEDefinition<'a>,
Source§impl<'a, Schema> QueryBuilder<'a, Schema, BuilderInit>
impl<'a, Schema> QueryBuilder<'a, Schema, BuilderInit>
Sourcepub fn insert<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, InsertInitial, Table>where
Table: SQLiteTable<'a>,
pub fn insert<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, InsertInitial, Table>where
Table: SQLiteTable<'a>,
Begins an INSERT query for the specified table.
This method starts building an INSERT statement. The table must be part of the schema and will be type-checked at compile time.
§Examples
let query = builder
.insert(user)
.values([InsertUser::new("Alice")]);
assert_eq!(query.to_sql().sql(), r#"INSERT INTO "users" ("name") VALUES (?)"#);Sourcepub fn update<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, UpdateInitial, Table>where
Table: SQLiteTable<'a>,
pub fn update<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, UpdateInitial, Table>where
Table: SQLiteTable<'a>,
Begins an UPDATE query for the specified table.
This method starts building an UPDATE statement. The table must be part of the schema and will be type-checked at compile time.
§Examples
let query = builder
.update(user)
.set(UpdateUser::default().with_name("Bob"))
.r#where(eq(user.id, 1));
assert_eq!(query.to_sql().sql(), r#"UPDATE "users" SET "name" = ? WHERE "users"."id" = ?"#);Sourcepub fn delete<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, DeleteInitial, Table>where
Table: SQLiteTable<'a>,
pub fn delete<Table>(
&self,
table: Table,
) -> QueryBuilder<'a, Schema, DeleteInitial, Table>where
Table: SQLiteTable<'a>,
Begins a DELETE query for the specified table.
This method starts building a DELETE statement. The table must be part of the schema and will be type-checked at compile time.
§Examples
let query = builder
.delete(user)
.r#where(lt(user.id, 10));
assert_eq!(query.to_sql().sql(), r#"DELETE FROM "users" WHERE "users"."id" < ?"#);pub fn with<C>(&self, cte: &C) -> QueryBuilder<'a, Schema, CTEInit>where
C: CTEDefinition<'a>,
Trait Implementations§
Source§impl<'a, Schema, State, Table, Marker, Row, Grouped> Clone for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
impl<'a, Schema, State, Table, Marker, Row, Grouped> Clone for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
Source§fn clone(&self) -> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
fn clone(&self) -> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, Schema, State, Table, Marker, Row, Grouped> Debug for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
impl<'a, Schema, State, Table, Marker, Row, Grouped> Debug for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
Source§impl<'a, Schema, State, Table, Marker, Row, Grouped> Default for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
impl<'a, Schema, State, Table, Marker, Row, Grouped> Default for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
Source§fn default() -> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
fn default() -> QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
Source§impl<'a, S, State, T, M, R, G> Expr<'a, SQLiteValue<'a>> for QueryBuilder<'a, S, State, T, M, R, G>
impl<'a, S, State, T, M, R, G> Expr<'a, SQLiteValue<'a>> for QueryBuilder<'a, S, State, T, M, R, G>
Source§type SQLType = <M as SubqueryType<'a, SQLiteValue<'a>>>::SQLType
type SQLType = <M as SubqueryType<'a, SQLiteValue<'a>>>::SQLType
Source§fn to_expr_sql(&self) -> SQL<'a, V>
fn to_expr_sql(&self) -> SQL<'a, V>
Source§fn into_expr_sql(self) -> SQL<'a, V>where
Self: Sized,
fn into_expr_sql(self) -> SQL<'a, V>where
Self: Sized,
Source§fn to_condition_sql(&self) -> Option<SQL<'a, V>>
fn to_condition_sql(&self) -> Option<SQL<'a, V>>
ConditionList. Read moreSource§fn into_condition_sql(self) -> Option<SQL<'a, V>>where
Self: Sized,
fn into_condition_sql(self) -> Option<SQL<'a, V>>where
Self: Sized,
Expr::to_condition_sql.Source§impl<'a, S, State, T, M, R, G> IntoSelect<'a, S, M, R> for QueryBuilder<'a, S, State, T, M, R, G>where
State: ExecutableState,
impl<'a, S, State, T, M, R, G> IntoSelect<'a, S, M, R> for QueryBuilder<'a, S, State, T, M, R, G>where
State: ExecutableState,
type State = State
type Table = T
fn into_select(self) -> QueryBuilder<'a, S, State, T, M, R>
Source§impl<'a, Schema, State, Table, Marker, Row, Grouped> ToSQL<'a, SQLiteValue<'a>> for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
impl<'a, Schema, State, Table, Marker, Row, Grouped> ToSQL<'a, SQLiteValue<'a>> for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>
Auto Trait Implementations§
impl<'a, Schema, State, Table, Marker, Row, Grouped> Freeze for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
PhantomData<Schema>: Freeze,
PhantomData<State>: Freeze,
PhantomData<Table>: Freeze,
PhantomData<Marker>: Freeze,
PhantomData<Row>: Freeze,
PhantomData<Grouped>: Freeze,
impl<'a, Schema, State, Table, Marker, Row, Grouped> RefUnwindSafe for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
PhantomData<Schema>: RefUnwindSafe,
PhantomData<State>: RefUnwindSafe,
PhantomData<Table>: RefUnwindSafe,
PhantomData<Marker>: RefUnwindSafe,
PhantomData<Row>: RefUnwindSafe,
PhantomData<Grouped>: RefUnwindSafe,
impl<'a, Schema, State, Table, Marker, Row, Grouped> Send for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
PhantomData<Schema>: Send,
PhantomData<State>: Send,
PhantomData<Table>: Send,
PhantomData<Marker>: Send,
PhantomData<Row>: Send,
PhantomData<Grouped>: Send,
impl<'a, Schema, State, Table, Marker, Row, Grouped> Sync for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
PhantomData<Schema>: Sync,
PhantomData<State>: Sync,
PhantomData<Table>: Sync,
PhantomData<Marker>: Sync,
PhantomData<Row>: Sync,
PhantomData<Grouped>: Sync,
impl<'a, Schema, State, Table, Marker, Row, Grouped> Unpin for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
PhantomData<Schema>: Unpin,
PhantomData<State>: Unpin,
PhantomData<Table>: Unpin,
PhantomData<Marker>: Unpin,
PhantomData<Row>: Unpin,
PhantomData<Grouped>: Unpin,
impl<'a, Schema, State, Table, Marker, Row, Grouped> UnsafeUnpin for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
PhantomData<Schema>: UnsafeUnpin,
PhantomData<State>: UnsafeUnpin,
PhantomData<Table>: UnsafeUnpin,
PhantomData<Marker>: UnsafeUnpin,
PhantomData<Row>: UnsafeUnpin,
PhantomData<Grouped>: UnsafeUnpin,
impl<'a, Schema, State, Table, Marker, Row, Grouped> UnwindSafe for QueryBuilder<'a, Schema, State, Table, Marker, Row, Grouped>where
PhantomData<Schema>: UnwindSafe,
PhantomData<State>: UnwindSafe,
PhantomData<Table>: UnwindSafe,
PhantomData<Marker>: UnwindSafe,
PhantomData<Row>: UnwindSafe,
PhantomData<Grouped>: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, V, L, R> ComparisonOperand<'a, V, L> for R
impl<'a, V, L, R> ComparisonOperand<'a, V, L> for R
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<'a, V, E> ExprExt<'a, V> for E
impl<'a, V, E> ExprExt<'a, V> for E
Source§fn eq<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn eq<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
=). Read moreSource§fn ne<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn ne<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
<>). Read moreSource§fn gt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn gt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
>). Read moreSource§fn ge<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn ge<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
>=). Read moreSource§fn lt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn lt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
<). Read moreSource§fn le<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn le<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
<=). Read moreSource§fn like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
Source§fn not_like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn not_like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
Source§fn is_null(
self,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
fn is_null( self, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
Source§fn is_not_null(
self,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
fn is_not_null( self, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
Source§fn between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output as AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>,
<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output: AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output as AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>,
<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output: AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>,
Source§fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output as AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>,
<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output: AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output as AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>,
<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output: AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>,
Source§fn in_array<I, R>(
self,
values: I,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>where
I: IntoIterator<Item = R>,
R: Expr<'a, V>,
Self::SQLType: Compatible<<R as Expr<'a, V>>::SQLType>,
fn in_array<I, R>(
self,
values: I,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>where
I: IntoIterator<Item = R>,
R: Expr<'a, V>,
Self::SQLType: Compatible<<R as Expr<'a, V>>::SQLType>,
Source§fn not_in_array<I, R>(
self,
values: I,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>where
I: IntoIterator<Item = R>,
R: Expr<'a, V>,
Self::SQLType: Compatible<<R as Expr<'a, V>>::SQLType>,
fn not_in_array<I, R>(
self,
values: I,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>where
I: IntoIterator<Item = R>,
R: Expr<'a, V>,
Self::SQLType: Compatible<<R as Expr<'a, V>>::SQLType>,
Source§fn in_subquery<S>(
self,
subquery: S,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
fn in_subquery<S>( self, subquery: S, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
Source§fn not_in_subquery<S>(
self,
subquery: S,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
fn not_in_subquery<S>( self, subquery: S, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
Source§fn is_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn is_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
Source§fn is_not_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
fn is_not_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,
Source§impl<'a, V, E> InSubqueryLhs<'a, V, Single> for E
impl<'a, V, E> InSubqueryLhs<'a, V, Single> for E
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request