------------------------------------------------------------------------------ Schema API ------------------------------------------------------------------------------ Find the ID associated with a label for schema and matrix access
| 324 | //------------------------------------------------------------------------------ |
| 325 | // Find the ID associated with a label for schema and matrix access |
| 326 | int _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 | |
| 337 | unsigned short GraphContext_SchemaCount(const GraphContext *gc, SchemaType t) { |
| 338 | ASSERT(gc); |
no test coverage detected