| 146 | } |
| 147 | |
| 148 | int 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 |
nothing calls this directly
no test coverage detected