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

Function with_agg_format

src/cypher/cypher.c:3920–3932  ·  view source on GitHub ↗

Format a WITH aggregation value into buf */

Source from the content-addressed store, hash-verified

3918
3919/* Format a WITH aggregation value into buf */
3920static void with_agg_format(const char *func, with_agg_t *agg, int ci, char *buf, size_t buf_sz) {
3921 if (strcmp(func, "SUM") == 0) {
3922 snprintf(buf, buf_sz, "%.10g", agg->sums[ci]);
3923 } else if (strcmp(func, "AVG") == 0) {
3924 snprintf(buf, buf_sz, "%.10g", agg->counts[ci] > 0 ? agg->sums[ci] / agg->counts[ci] : 0.0);
3925 } else if (strcmp(func, "MIN") == 0) {
3926 snprintf(buf, buf_sz, "%.10g", agg->mins[ci]);
3927 } else if (strcmp(func, "MAX") == 0) {
3928 snprintf(buf, buf_sz, "%.10g", agg->maxs[ci]);
3929 } else {
3930 snprintf(buf, buf_sz, "%d", agg->counts[ci]);
3931 }
3932}
3933
3934/* Add a virtual variable binding for one WITH item */
3935static 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