Struct deadpool_redis::Cmd [−][src]
pub struct Cmd { /* fields omitted */ }
Expand description
Wrapper for redis::Cmd
which makes it compatible with the query_async
method which takes a ConnectionLike
as argument.
This Implementation could be simplified a lot via RFC 2393.
See redis::Cmd
Implementations
impl Cmd
[src]
impl Cmd
[src]pub fn new() -> Self
[src]
pub fn new() -> Self
[src]See redis::Cmd::new
pub fn arg<T: ToRedisArgs>(&mut self, arg: T) -> &mut Cmd
[src]
pub fn arg<T: ToRedisArgs>(&mut self, arg: T) -> &mut Cmd
[src]See redis::Cmd::arg
pub fn cursor_arg(&mut self, cursor: u64) -> &mut Cmd
[src]
pub fn cursor_arg(&mut self, cursor: u64) -> &mut Cmd
[src]pub async fn query_async<T: FromRedisValue + Send>(
&self,
conn: &mut ConnectionWrapper
) -> RedisResult<T>
[src]
pub async fn query_async<T: FromRedisValue + Send>(
&self,
conn: &mut ConnectionWrapper
) -> RedisResult<T>
[src]pub async fn execute_async(
&self,
con: &mut ConnectionWrapper
) -> RedisResult<()>
[src]
pub async fn execute_async(
&self,
con: &mut ConnectionWrapper
) -> RedisResult<()>
[src]Methods from Deref<Target = Cmd>
pub fn arg<T>(&mut self, arg: T) -> &mut Cmd where
T: ToRedisArgs,
[src]
pub fn arg<T>(&mut self, arg: T) -> &mut Cmd where
T: ToRedisArgs,
[src]Appends an argument to the command. The argument passed must
be a type that implements ToRedisArgs
. Most primitive types as
well as vectors of primitive types implement it.
For instance all of the following are valid:
redis::cmd("SET").arg(&["my_key", "my_value"]); redis::cmd("SET").arg("my_key").arg(42); redis::cmd("SET").arg("my_key").arg(b"my_value");
pub fn cursor_arg(&mut self, cursor: u64) -> &mut Cmd
[src]
pub fn cursor_arg(&mut self, cursor: u64) -> &mut Cmd
[src]Works similar to arg
but adds a cursor argument. This is always
an integer and also flips the command implementation to support a
different mode for the iterators where the iterator will ask for
another batch of items when the local data is exhausted.
let mut cmd = redis::cmd("SSCAN"); let mut iter : redis::Iter<isize> = cmd.arg("my_set").cursor_arg(0).clone().iter(&mut con).unwrap(); for x in iter { // do something with the item }
pub fn get_packed_command(&self) -> Vec<u8, Global>
[src]
pub fn get_packed_command(&self) -> Vec<u8, Global>
[src]Returns the packed command as a byte vector.
pub fn in_scan_mode(&self) -> bool
[src]
pub fn in_scan_mode(&self) -> bool
[src]Returns true if the command is in scan mode.
pub fn query<T>(&self, con: &mut dyn ConnectionLike) -> Result<T, RedisError> where
T: FromRedisValue,
[src]
pub fn query<T>(&self, con: &mut dyn ConnectionLike) -> Result<T, RedisError> where
T: FromRedisValue,
[src]Sends the command as query to the connection and converts the result to the target redis value. This is the general way how you can retrieve data.
pub async fn query_async<C, T>(
&'_ self,
con: &'_ mut C
) -> Result<T, RedisError> where
C: ConnectionLike,
T: FromRedisValue,
[src]
pub async fn query_async<C, T>(
&'_ self,
con: &'_ mut C
) -> Result<T, RedisError> where
C: ConnectionLike,
T: FromRedisValue,
[src]Async version of query
.
pub fn execute(&self, con: &mut dyn ConnectionLike)
[src]
pub fn execute(&self, con: &mut dyn ConnectionLike)
[src]This is a shortcut to query()
that does not return a value and
will fail the task if the query fails because of an error. This is
mainly useful in examples and for simple commands like setting
keys.
This is equivalent to a call of query like this:
let _ : () = redis::cmd("PING").query(&mut con).unwrap();