Struct redis_client::commands::RedisCommand
[−]
[src]
pub struct RedisCommand { // some fields omitted }
A RedisCommand purpose is to build redis commands. It can contains one or more commands for pipelining
Example:
let cmd = &mut redis_client::RedisCommand::new(); cmd.set("key", "value2").get("key");
or its equivalent:
let cmd = &mut redis_client::RedisCommand::new(); cmd.add_cmd("SET").add_arg("key").add_arg("value2").end().add_cmd("GET").add_arg("key").end();
Methods
impl RedisCommand
fn new() -> RedisCommand
fn add_cmd<C>(&mut self, command: C) -> &mut RedisCommand where C: ToString
[−]
Add a string representing the command (APPEND, GET, SET...) to the command. (Each command should start with this method)
fn add_arg<A>(&mut self, arg: A) -> &mut RedisCommand where A: ToString
[−]
Add a whitespace and a string to the commands
fn add_args<A>(&mut self, args: Vec<A>) -> &mut RedisCommand where A: ToString
[−]
Add a whitespace and a string for each one of the vector's items to the commands
fn add_arg_map<F: ToString>(&mut self, args: HashMap<String, F>) -> &mut RedisCommand
[−]
Add a whitespace a key another whitespace and the value for each pair of the hash map to the curent command
fn add_binary_arg(&mut self, arg: &[u8]) -> &mut RedisCommand
[−]
Add a whitespace and then an array of byte to the command
fn end(&mut self) -> &mut RedisCommand
[−]
Teminate a command
fn get_command_nb(&self) -> usize
[−]
Get the number of commands in the RedisCommand object