Documents RM_Call's fmt (#5448)

Improve RM_Call inline documentation about the fmt argument
so that we don't completely depend on the web docs.

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit ce15620dc1)
This commit is contained in:
Itamar Haber 2020-09-09 15:09:41 +03:00 committed by Oran Agra
parent 8b0d797ecd
commit 3cd6c26056

View File

@ -3303,6 +3303,23 @@ fmterr:
}
/* Exported API to call any Redis command from modules.
*
* * **cmdname**: The Redis command to call.
* * **fmt**: A format specifier string for the command's arguments. Each
* of the arguments should be specified by a valid type specification:
* b The argument is a buffer and is immediately followed by another
* argument that is the buffer's length.
* c The argument is a pointer to a plain C string (null-terminated).
* l The argument is long long integer.
* s The argument is a RedisModuleString.
* v The argument(s) is a vector of RedisModuleString.
*
* The format specifier can also include modifiers:
* ! Sends the Redis command and its arguments to replicas and AOF.
* A Suppress AOF propagation, send only to replicas (requires `!`).
* R Suppress replicas propagation, send only to AOF (requires `!`).
* * **...**: The actual arguments to the Redis command.
*
* On success a RedisModuleCallReply object is returned, otherwise
* NULL is returned and errno is set to the following values:
*
@ -3314,6 +3331,14 @@ fmterr:
* in a readonly state.
* ENETDOWN: operation in Cluster instance when cluster is down.
*
* Example code fragment:
*
* reply = RedisModule_Call(ctx,"INCRBY","sc",argv[1],"10");
* if (RedisModule_CallReplyType(reply) == REDISMODULE_REPLY_INTEGER) {
* long long myval = RedisModule_CallReplyInteger(reply);
* // Do something with myval.
* }
*
* This API is documented here: https://redis.io/topics/modules-intro
*/
RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const char *fmt, ...) {