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

Function GraphContext_AddSchema

src/graph/graphcontext.c:399–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399Schema *GraphContext_AddSchema
400(
401 GraphContext *gc,
402 const char *label,
403 SchemaType t
404) {
405 int id;
406 Schema *schema;
407
408 if(t == SCHEMA_NODE) {
409 id = Graph_AddLabel(gc->g);
410 schema = Schema_New(SCHEMA_NODE, id, label);
411 array_append(gc->node_schemas, schema);
412 } else {
413 id = Graph_AddRelationType(gc->g);
414 schema = Schema_New(SCHEMA_EDGE, id, label);
415 array_append(gc->relation_schemas, schema);
416 }
417
418 // new schema added, update graph version
419 _GraphContext_UpdateVersion(gc, label);
420
421 return schema;
422}
423
424void GraphContext_RemoveSchema(GraphContext *gc, int schema_id, SchemaType t) {
425 if(t == SCHEMA_NODE) {

Callers 5

AddSchemaFunction · 0.85
_fake_graph_contextFunction · 0.85

Calls 4

Graph_AddLabelFunction · 0.85
Schema_NewFunction · 0.85
Graph_AddRelationTypeFunction · 0.85

Tested by 1

_fake_graph_contextFunction · 0.68