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

Function _GraphContext_GetLabelID

src/graph/graphcontext.c:326–335  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Schema API ------------------------------------------------------------------------------ Find the ID associated with a label for schema and matrix access

Source from the content-addressed store, hash-verified

324//------------------------------------------------------------------------------
325// Find the ID associated with a label for schema and matrix access
326int _GraphContext_GetLabelID(const GraphContext *gc, const char *label, SchemaType t) {
327 // Choose the appropriate schema array given the entity type
328 Schema **schemas = (t == SCHEMA_NODE) ? gc->node_schemas : gc->relation_schemas;
329
330 // TODO optimize lookup
331 for(uint32_t i = 0; i < array_len(schemas); i ++) {
332 if(!strcmp(label, schemas[i]->name)) return i;
333 }
334 return GRAPH_NO_LABEL; // equivalent to GRAPH_NO_RELATION
335}
336
337unsigned short GraphContext_SchemaCount(const GraphContext *gc, SchemaType t) {
338 ASSERT(gc);

Callers 1

GraphContext_GetSchemaFunction · 0.85

Calls 1

array_lenFunction · 0.85

Tested by

no test coverage detected