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

Function build_graph_stats_sql

nodedb-client/src/remote/client/graph.rs:223–233  ·  view source on GitHub ↗

Build the SQL for `SHOW GRAPH STATS`. Collection and `as_of` are both optional; when absent the corresponding clause is omitted entirely.

(collection: Option<&str>, as_of: Option<i64>)

Source from the content-addressed store, hash-verified

221/// Build the SQL for `SHOW GRAPH STATS`. Collection and `as_of` are both
222/// optional; when absent the corresponding clause is omitted entirely.
223pub(crate) fn build_graph_stats_sql(collection: Option<&str>, as_of: Option<i64>) -> String {
224 let mut sql = "SHOW GRAPH STATS".to_string();
225 if let Some(c) = collection {
226 sql.push(' ');
227 sql.push_str(&quote_string_literal(c));
228 }
229 if let Some(ms) = as_of {
230 sql.push_str(&format!(" AS OF SYSTEM TIME {ms}"));
231 }
232 sql
233}
234
235/// Parse a multi-row response from `SHOW GRAPH STATS` into a vec of
236/// `GraphStats`. Empty rows produce an empty vec. Column-shape mismatches

Callers 6

graph_stats_implMethod · 0.85
build_sql_tenant_wideFunction · 0.85
build_sql_as_ofFunction · 0.85

Calls 3

quote_string_literalFunction · 0.85
to_stringMethod · 0.80
pushMethod · 0.45

Tested by 5

build_sql_tenant_wideFunction · 0.68
build_sql_as_ofFunction · 0.68