Skip to content

Commit

Permalink
added: echo parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua committed Jul 9, 2022
1 parent f12e355 commit b19f881
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ function toTpReader(redisConn: Deno.Conn): TextProtoReader {
* ```
* @param redisConn Redis connection to the server.
* @param command Redis command, which is an array of arguments.
* @param echo If `true`, a reply is read. Defaults to true.
* @returns Parsed Redis reply
*/
export async function sendCommand(
redisConn: Deno.Conn,
command: Command,
): Promise<Reply> {
echo = true,
): Promise<Reply | void> {
await writeRequest(redisConn, stringifyRequest(command));
return await readReply(toTpReader(redisConn));
if (echo) {
return await readReply(toTpReader(redisConn));
}
}

Expand Down

0 comments on commit b19f881

Please sign in to comment.