pub fn extract<'a, 'f, V, E>(
field: &'f str,
expr: E,
) -> SQLExpr<'a, V, Double, E::Nullable, Scalar>Expand description
EXTRACT - extracts a component from a temporal expression (PostgreSQL/Standard SQL).
Returns Double type. Common fields: ‘year’, ‘month’, ‘day’, ‘hour’, ‘minute’, ‘second’, ‘dow’ (day of week), ‘doy’ (day of year), ‘epoch’ (Unix timestamp)
Preserves the nullability of the input expression.
§Example
ⓘ
use drizzle_core::expr::extract;
// SELECT EXTRACT(YEAR FROM users.created_at)
let year = extract("YEAR", users.created_at);