Skip to main content

raw

Function raw 

Source
pub fn raw<'a, V, T>(sql: &'a str) -> SQLExpr<'a, V, T, Null, Scalar, ()>
where V: SQLParam + 'a, T: DataType,
Expand description

A raw SQL fragment with a declared SQL type, typed as nullable.

The text is inserted into the query as is, so never build it from user input. The type system trusts the declared type T and cannot check the SQL. The result is nullable; use raw_non_null when the SQL can never be NULL.

ยงExamples

let one = raw::<Value, Int>("1");
assert_eq!(eq(users.id, one).sql(), r#""users"."id" = 1"#);