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

Function usize_arg

nodedb-query/src/window/offset.rs:20–28  ·  view source on GitHub ↗
(spec: &WindowFuncSpec, idx: usize, default: usize)

Source from the content-addressed store, hash-verified

18}
19
20fn usize_arg(spec: &WindowFuncSpec, idx: usize, default: usize) -> usize {
21 spec.args
22 .get(idx)
23 .and_then(|e| match e {
24 SqlExpr::Literal(v) => v.as_f64().map(|n| n as usize),
25 _ => None,
26 })
27 .unwrap_or(default)
28}
29
30fn default_arg(spec: &WindowFuncSpec, idx: usize) -> serde_json::Value {
31 spec.args

Callers 3

apply_lagFunction · 0.70
apply_leadFunction · 0.70
apply_nth_valueFunction · 0.70

Calls 2

getMethod · 0.45
as_f64Method · 0.45

Tested by

no test coverage detected