Skip to main content

least

Function least 

Source
pub fn least<'a, V, L, R>(
    left: L,
    right: R,
) -> SQLExpr<'a, V, L::SQLType, <L::Nullable as NullAnd<R::Nullable>>::Output, <L::Aggregate as AggOr<R::Aggregate>>::Output>
Expand description

LEAST - returns the smallest of the given values (PostgreSQL).

Both arguments must have compatible types. PostgreSQL ignores NULL inputs, so LEAST(1, NULL) returns 1. The result is only NULL when all inputs are NULL.

ยงExample

use drizzle_core::expr::least;

// Cap at maximum of 100
let score = least(users.score, 100);