Skip to main content

fold_select

Function fold_select 

Source
pub fn fold_select(sql: &str, now_micros: i64) -> Result<Folded, SqlError>
Expand description

Evaluate a table-free SELECT expr[, expr…]; against the given clock (epoch microseconds). Refusals are SqlErrors whose text names the construct — never a silent wrong answer.

let f = kevy_sql::fold_select("SELECT length('kevy') * 2;", 0)?;
assert_eq!(f.columns, [kevy_sql::Scalar::Int(8)]);

// a table query is refused by name rather than folded
let e = kevy_sql::fold_select("SELECT 1 FROM t;", 0).unwrap_err();
assert!(e.message.starts_with("FROM is not foldable"));