Trait bitbazaar::redis::RedisBatchReturningOps

source ·
pub trait RedisBatchReturningOps<'c> {
    type NextType<T>;

    // Required methods
    fn script<ScriptOutput: FromRedisValue>(
        self,
        script_invokation: RedisScriptInvoker<'c>,
    ) -> Self::NextType<ScriptOutput>;
    fn exists(self, namespace: &str, key: &str) -> Self::NextType<bool>;
    fn mexists<'key>(
        self,
        namespace: &str,
        keys: impl IntoIterator<Item = &'key str>,
    ) -> Self::NextType<Vec<bool>>;
    fn get<Value: FromRedisValue>(
        self,
        namespace: &str,
        key: &str,
    ) -> Self::NextType<Option<Value>>;
    fn mget<Value>(
        self,
        namespace: &str,
        keys: impl IntoIterator<Item = impl AsRef<str>>,
    ) -> Self::NextType<Vec<Option<Value>>>;
    fn zrangebyscore_high_to_low<Value: FromRedisValue>(
        self,
        set_namespace: &str,
        set_key: &str,
        min: i64,
        max: i64,
        limit: Option<isize>,
    ) -> Self::NextType<Vec<(Option<Value>, i64)>>;
    fn zrangebyscore_low_to_high<Value: FromRedisValue>(
        self,
        set_namespace: &str,
        set_key: &str,
        min: i64,
        max: i64,
        limit: Option<isize>,
    ) -> Self::NextType<Vec<(Option<Value>, i64)>>;
}
Expand description

Implements all the supported redis operations that need to modify the return type and hence need macros.

Required Associated Types§

source

type NextType<T>

The producer for the next batch struct sig.

Required Methods§

source

fn script<ScriptOutput: FromRedisValue>( self, script_invokation: RedisScriptInvoker<'c>, ) -> Self::NextType<ScriptOutput>

Run an arbitrary redis (lua script).

source

fn exists(self, namespace: &str, key: &str) -> Self::NextType<bool>

Check if a key exists.

source

fn mexists<'key>( self, namespace: &str, keys: impl IntoIterator<Item = &'key str>, ) -> Self::NextType<Vec<bool>>

Check if multiple keys exists.

source

fn get<Value: FromRedisValue>( self, namespace: &str, key: &str, ) -> Self::NextType<Option<Value>>

Get a value from a key. Returning None if the key doesn’t exist.

source

fn mget<Value>( self, namespace: &str, keys: impl IntoIterator<Item = impl AsRef<str>>, ) -> Self::NextType<Vec<Option<Value>>>

Get multiple values (MGET) of the same type at once. Returning None for each key that didn’t exist.

source

fn zrangebyscore_high_to_low<Value: FromRedisValue>( self, set_namespace: &str, set_key: &str, min: i64, max: i64, limit: Option<isize>, ) -> Self::NextType<Vec<(Option<Value>, i64)>>

HIGHEST TO LOWEST SCORES. Retrieve entries from an ordered set by score range. (range is inclusive) Items that cannot be decoded into the specified type are returned as None.

VARIATIONS FROM DEFAULT:

  • Rev used: returned high to low.

Arguments:

  • set_namespace: The namespace of the set.
  • set_key: The key of the set.
  • min: The minimum score.
  • max: The maximum score.
  • limit: The maximum number of items to return.

https://redis.io/commands/zrangebyscore/

source

fn zrangebyscore_low_to_high<Value: FromRedisValue>( self, set_namespace: &str, set_key: &str, min: i64, max: i64, limit: Option<isize>, ) -> Self::NextType<Vec<(Option<Value>, i64)>>

LOWEST TO HIGHEST SCORES. Retrieve entries from an ordered set by score range. (range is inclusive) Items that cannot be decoded into the specified type are returned as None.

Arguments:

  • set_namespace: The namespace of the set.
  • set_key: The key of the set.
  • min: The minimum score.
  • max: The maximum score.
  • limit: The maximum number of items to return.

https://redis.io/commands/zrangebyscore/

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, 'b, 'c> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, ()>

§

type NextType<T> = RedisBatch<'a, 'b, 'c, (T,)>

source§

impl<'a, 'b, 'c, A: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A,)>

§

type NextType<T> = RedisBatch<'a, 'b, 'c, (A, T)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B)>

§

type NextType<T> = RedisBatch<'a, 'b, 'c, (A, B, T)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C)>

§

type NextType<T> = RedisBatch<'a, 'b, 'c, (A, B, C, T)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D)>

§

type NextType<T> = RedisBatch<'a, 'b, 'c, (A, B, C, D, T)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue, F: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E, F)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue, F: FromRedisValue, G: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E, F, G)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue, F: FromRedisValue, G: FromRedisValue, H: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E, F, G, H)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue, F: FromRedisValue, G: FromRedisValue, H: FromRedisValue, I: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E, F, G, H, I)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue, F: FromRedisValue, G: FromRedisValue, H: FromRedisValue, I: FromRedisValue, J: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E, F, G, H, I, J)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue, F: FromRedisValue, G: FromRedisValue, H: FromRedisValue, I: FromRedisValue, J: FromRedisValue, K: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E, F, G, H, I, J, K)>

source§

impl<'a, 'b, 'c, A: FromRedisValue, B: FromRedisValue, C: FromRedisValue, D: FromRedisValue, E: FromRedisValue, F: FromRedisValue, G: FromRedisValue, H: FromRedisValue, I: FromRedisValue, J: FromRedisValue, K: FromRedisValue, L: FromRedisValue> RedisBatchReturningOps<'c> for RedisBatch<'a, 'b, 'c, (A, B, C, D, E, F, G, H, I, J, K, L)>