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

Function expr_as_usize_literal

nodedb-sql/src/coerce.rs:58–64  ·  view source on GitHub ↗

Resolve an `Expr::Value` into a `usize` if numeric-shaped. Thin wrapper that unpacks the `Expr` → `Value` layer so callers reading LIMIT/OFFSET clauses don't each re-write the unpack.

(expr: &ast::Expr)

Source from the content-addressed store, hash-verified

56/// wrapper that unpacks the `Expr` → `Value` layer so callers reading
57/// LIMIT/OFFSET clauses don't each re-write the unpack.
58pub fn expr_as_usize_literal(expr: &ast::Expr) -> Option<usize> {
59 if let ast::Expr::Value(v) = expr {
60 as_usize_literal(&v.value)
61 } else {
62 None
63 }
64}
65
66/// Resolve a `Value` into an `f64` if numeric-shaped.
67///

Callers 2

limit_from_queryFunction · 0.85
apply_limitFunction · 0.85

Calls 1

as_usize_literalFunction · 0.85

Tested by

no test coverage detected