MCPcopy Create free account
hub / github.com/PRQL/prql / parse_bound

Function parse_bound

prqlc/prqlc/src/sql/gen_expr.rs:880–891  ·  view source on GitHub ↗
(bound: rq::Expr)

Source from the content-addressed store, hash-verified

878
879fn try_into_window_frame(frame: WindowFrame<rq::Expr>) -> Result<sql_ast::WindowFrame> {
880 fn parse_bound(bound: rq::Expr) -> Result<WindowFrameBound> {
881 let as_int = unpack_as_int_literal(bound)?;
882 Ok(match as_int {
883 0 => WindowFrameBound::CurrentRow,
884 1.. => WindowFrameBound::Following(Some(Box::new(sql_ast::Expr::Value(
885 sql_ast::Value::Number(as_int.to_string(), false).into(),
886 )))),
887 _ => WindowFrameBound::Preceding(Some(Box::new(sql_ast::Expr::Value(
888 sql_ast::Value::Number((-as_int).to_string(), false).into(),
889 )))),
890 })
891 }
892
893 Ok(sql_ast::WindowFrame {
894 units: match frame.kind {

Callers 1

try_into_window_frameFunction · 0.85

Calls 1

unpack_as_int_literalFunction · 0.85

Tested by

no test coverage detected