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

Function binding_get_virtual

src/cypher/cypher.c:3240–3272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3238/* ── Binding virtual variables (for WITH clause) ──────────────── */
3239
3240static const char *binding_get_virtual(binding_t *b, const char *var, const char *prop) {
3241 if (!var) {
3242 return "";
3243 }
3244 /* Check virtual vars first (from WITH projection) */
3245 char full[CBM_SZ_256];
3246 if (prop) {
3247 snprintf(full, sizeof(full), "%s.%s", var, prop);
3248 } else {
3249 snprintf(full, sizeof(full), "%s", var);
3250 }
3251 for (int i = 0; i < b->var_count; i++) {
3252 if (strcmp(b->var_names[i], full) == 0) {
3253 return b->var_nodes[i].name ? b->var_nodes[i].name : "";
3254 }
3255 }
3256 /* Fall through to normal lookup */
3257 cbm_edge_t *e = binding_get_edge(b, var);
3258 if (e) {
3259 /* Bare `RETURN r` on an edge: surface the full properties JSON
3260 * (or "{}" if none) so callers can inspect timestamps, weights,
3261 * etc. without naming each property. */
3262 return prop ? edge_prop(e, prop) : (e->properties_json ? e->properties_json : "{}");
3263 }
3264 cbm_node_t *n = binding_get(b, var);
3265 if (n) {
3266 if (prop) {
3267 return node_prop(n, prop, b->store);
3268 }
3269 return n->name ? n->name : "";
3270 }
3271 return "";
3272}
3273
3274/* ── String function application ──────────────────────────────── */
3275

Callers 6

eval_func_argFunction · 0.85
project_itemFunction · 0.85
order_key_valueFunction · 0.85
with_agg_accumulateFunction · 0.85
with_proj_keyFunction · 0.85
ret_agg_accumulateFunction · 0.85

Calls 4

binding_get_edgeFunction · 0.85
edge_propFunction · 0.85
binding_getFunction · 0.85
node_propFunction · 0.85

Tested by

no test coverage detected