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

Function eval_ast_literal

nodedb/src/data/executor/handlers/recursive_value.rs:261–280  ·  view source on GitHub ↗
(v: &sqlparser::ast::Value)

Source from the content-addressed store, hash-verified

259}
260
261fn eval_ast_literal(v: &sqlparser::ast::Value) -> Option<nodedb_types::Value> {
262 use sqlparser::ast::Value;
263 match v {
264 Value::Number(n, _) => {
265 if let Ok(i) = n.parse::<i64>() {
266 Some(nodedb_types::Value::Integer(i))
267 } else if let Ok(f) = n.parse::<f64>() {
268 Some(nodedb_types::Value::Float(f))
269 } else {
270 None
271 }
272 }
273 Value::SingleQuotedString(s) | Value::DoubleQuotedString(s) => {
274 Some(nodedb_types::Value::String(s.clone()))
275 }
276 Value::Boolean(b) => Some(nodedb_types::Value::Bool(*b)),
277 Value::Null => Some(nodedb_types::Value::Null),
278 _ => None,
279 }
280}
281
282fn eval_binary_op(
283 l: &nodedb_types::Value,

Callers 1

eval_ast_exprFunction · 0.85

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected