MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / expect_u32

Function expect_u32

nodedb-sql/src/planner/array_fn/helpers.rs:72–86  ·  view source on GitHub ↗
(expr: &ast::Expr, ctx: &str)

Source from the content-addressed store, hash-verified

70}
71
72pub(super) fn expect_u32(expr: &ast::Expr, ctx: &str) -> Result<u32> {
73 match expr {
74 ast::Expr::Value(v) => match &v.value {
75 ast::Value::Number(n, _) => n.parse::<u32>().map_err(|_| SqlError::TypeMismatch {
76 detail: format!("{ctx}: expected u32, got {n}"),
77 }),
78 other => Err(SqlError::TypeMismatch {
79 detail: format!("{ctx}: expected number, got {other}"),
80 }),
81 },
82 _ => Err(SqlError::TypeMismatch {
83 detail: format!("{ctx}: expected number literal, got {expr}"),
84 }),
85 }
86}
87
88pub(super) fn expect_string_array(expr: &ast::Expr, ctx: &str) -> Result<Vec<String>> {
89 let elems = match expr {

Callers 1

plan_sliceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected