MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / AST_PrepareUpdateOp

Function AST_PrepareUpdateOp

src/ast/ast_build_op_contexts.c:401–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399//------------------------------------------------------------------------------
400
401rax *AST_PrepareUpdateOp
402(
403 GraphContext *gc,
404 const cypher_astnode_t *clause
405) {
406 cypher_astnode_type_t type = cypher_astnode_type(clause);
407 ASSERT(type == CYPHER_AST_SET || type == CYPHER_AST_REMOVE);
408
409 rax *updates = raxNew(); // entity alias -> EntityUpdateEvalCtx
410 if(type == CYPHER_AST_SET) {
411 uint nitems = cypher_ast_set_nitems(clause);
412 for(uint i = 0; i < nitems; i++) {
413 const cypher_astnode_t *set_item =
414 cypher_ast_set_get_item(clause, i);
415 _ConvertUpdateItem(gc, updates, set_item);
416 }
417 } else {
418 uint nitems = cypher_ast_remove_nitems(clause);
419 for(uint i = 0; i < nitems; i++) {
420 const cypher_astnode_t *remove_item =
421 cypher_ast_remove_get_item(clause, i);
422 _ConvertUpdateItem(gc, updates, remove_item);
423 }
424 }
425
426 return updates;
427}
428
429//------------------------------------------------------------------------------
430// CREATE operation

Callers 1

_buildUpdateOpFunction · 0.85

Calls 1

_ConvertUpdateItemFunction · 0.85

Tested by

no test coverage detected