pub trait Expr<'a, V: SQLParam>: ToSQL<'a, V> {
type SQLType: DataType;
type Nullable: Nullability;
type Aggregate: AggregateKind;
}Expand description
An expression in SQL with an associated data type.
This is the core trait for type-safe SQL expressions. Every SQL expression (column, literal, function result) implements this with its SQL type.
§Type Parameters
'a: Lifetime of borrowed data in the expressionV: The dialect’s value type (SQLiteValue, PostgresValue)
§Associated Types
SQLType: The SQL data type this expression evaluates toNullable: Whether this expression can be NULLAggregate: Whether this is an aggregate or scalar expression
§Example
ⓘ
use drizzle_core::expr::{Expr, NonNull, Scalar};
use drizzle_core::types::Int;
// i32 literals are Int, NonNull, Scalar
fn check_expr<'a, V, E: Expr<'a, V>>() {}
check_expr::<_, i32>(); // SQLType=Int, Nullable=NonNull, Aggregate=ScalarRequired Associated Types§
Sourcetype Nullable: Nullability
type Nullable: Nullability
Whether this expression can be NULL.
Sourcetype Aggregate: AggregateKind
type Aggregate: AggregateKind
Whether this is an aggregate (COUNT, SUM) or scalar expression.