Skip to main content

random

Function random 

Source
pub fn random<'a, V>() -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Random, NonNull, Scalar, ()>
where V: SQLParam + 'a,
Expand description

A random value.

Renders RANDOM() on SQLite and PostgreSQL and RAND() on MySQL. The result type depends on the dialect: SQLite returns a 64-bit integer, PostgreSQL and MySQL a float in [0, 1). It is never NULL.

ยงExamples

assert_eq!(random::<Value>().sql(), "RANDOM()");