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

Function expect_string_literal

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

Source from the content-addressed store, hash-verified

55}
56
57pub(super) fn expect_string_literal(expr: &ast::Expr, ctx: &str) -> Result<String> {
58 match expr {
59 ast::Expr::Value(v) => match &v.value {
60 ast::Value::SingleQuotedString(s) => Ok(s.clone()),
61 other => Err(SqlError::Unsupported {
62 detail: format!("{ctx}: expected string literal, got {other}"),
63 }),
64 },
65 ast::Expr::Identifier(ident) => Ok(normalize_ident(ident)),
66 _ => Err(SqlError::Unsupported {
67 detail: format!("{ctx}: expected string literal, got {expr}"),
68 }),
69 }
70}
71
72pub(super) fn expect_u32(expr: &ast::Expr, ctx: &str) -> Result<u32> {
73 match expr {

Callers 5

plan_sliceFunction · 0.85
plan_aggFunction · 0.85
plan_elementwiseFunction · 0.85
require_array_nameFunction · 0.85
expect_string_arrayFunction · 0.85

Calls 2

normalize_identFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected