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

Function Graph_Config

src/commands/cmd_config.c:148–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148int Graph_Config
149(
150 RedisModuleCtx *ctx,
151 RedisModuleString **argv,
152 int argc
153) {
154 // GRAPH.CONFIG <GET|SET> <NAME> [value]
155 if(argc < 3) {
156 return RedisModule_WrongArity(ctx);
157 }
158
159 const char *action = RedisModule_StringPtrLen(argv[1], NULL);
160
161 if(!strcasecmp(action, "GET")) {
162 // GRAPH.CONFIG GET <NAME>
163 if(argc != 3) {
164 return RedisModule_WrongArity(ctx);
165 }
166 _Config_get(ctx, argv, argc);
167 } else if(!strcasecmp(action, "SET")) {
168 // GRAPH.CONFIG SET <NAME> [value] <NAME> [value] ...
169 // emit an error if we received an odd number of arguments,
170 // as this indicates an invalid configuration
171 if(argc < 4 || (argc % 2) == 1) {
172 return RedisModule_WrongArity(ctx);
173 }
174 _Config_set(ctx, argv+2, argc-2);
175 } else {
176 RedisModule_ReplyWithError(ctx, "Unknown subcommand for GRAPH.CONFIG");
177 }
178
179 return REDISMODULE_OK;
180}
181

Callers

nothing calls this directly

Calls 2

_Config_getFunction · 0.85
_Config_setFunction · 0.85

Tested by

no test coverage detected