MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / with_agg_format

Function with_agg_format

src/cypher/cypher.c:3580–3592  ·  view source on GitHub ↗

Format a WITH aggregation value into buf */

Source from the content-addressed store, hash-verified

3578
3579/* Format a WITH aggregation value into buf */
3580static void with_agg_format(const char *func, with_agg_t *agg, int ci, char *buf, size_t buf_sz) {
3581 if (strcmp(func, "SUM") == 0) {
3582 snprintf(buf, buf_sz, "%.10g", agg->sums[ci]);
3583 } else if (strcmp(func, "AVG") == 0) {
3584 snprintf(buf, buf_sz, "%.10g", agg->counts[ci] > 0 ? agg->sums[ci] / agg->counts[ci] : 0.0);
3585 } else if (strcmp(func, "MIN") == 0) {
3586 snprintf(buf, buf_sz, "%.10g", agg->mins[ci]);
3587 } else if (strcmp(func, "MAX") == 0) {
3588 snprintf(buf, buf_sz, "%.10g", agg->maxs[ci]);
3589 } else {
3590 snprintf(buf, buf_sz, "%d", agg->counts[ci]);
3591 }
3592}
3593
3594/* Add a virtual variable binding for one WITH item */
3595static void with_add_vbinding_var(binding_t *vb, const char *alias, const char *val) {

Callers 1

execute_with_aggregateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected