Trait HashCommands

Source
pub trait HashCommands<'a> {
Show 17 methods // Provided methods fn hdel<K, F, C>( self, key: K, fields: C, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, F: SingleArg, C: SingleArgCollection<F> { ... } fn hexists<K, F>(self, key: K, field: F) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg, F: SingleArg { ... } fn hget<K, F, V>(self, key: K, field: F) -> PreparedCommand<'a, Self, V> where Self: Sized, K: SingleArg, F: SingleArg, V: PrimitiveResponse { ... } fn hgetall<K, F, V, A>(self, key: K) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, F: PrimitiveResponse, V: PrimitiveResponse, A: KeyValueCollectionResponse<F, V> { ... } fn hincrby<K, F>( self, key: K, field: F, increment: i64, ) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg, F: SingleArg { ... } fn hincrbyfloat<K, F>( self, key: K, field: F, increment: f64, ) -> PreparedCommand<'a, Self, f64> where Self: Sized, K: SingleArg, F: SingleArg { ... } fn hkeys<K, F, A>(self, key: K) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, F: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<F> + DeserializeOwned { ... } fn hlen<K>(self, key: K) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg { ... } fn hmget<K, F, V, C, A>( self, key: K, fields: C, ) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, F: SingleArg, C: SingleArgCollection<F>, V: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<V> + DeserializeOwned { ... } fn hrandfield<K, F>(self, key: K) -> PreparedCommand<'a, Self, F> where Self: Sized, K: SingleArg, F: PrimitiveResponse { ... } fn hrandfields<K, F, A>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, F: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<F> + DeserializeOwned { ... } fn hrandfields_with_values<K, F, V, A>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, F: PrimitiveResponse, V: PrimitiveResponse, A: KeyValueCollectionResponse<F, V> { ... } fn hscan<K, F, V>( self, key: K, cursor: u64, options: HScanOptions, ) -> PreparedCommand<'a, Self, HScanResult<F, V>> where Self: Sized, K: SingleArg, F: PrimitiveResponse + DeserializeOwned, V: PrimitiveResponse + DeserializeOwned { ... } fn hset<K, F, V, I>( self, key: K, items: I, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, F: SingleArg, V: SingleArg, I: KeyValueArgsCollection<F, V> { ... } fn hsetnx<K, F, V>( self, key: K, field: F, value: V, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg, F: SingleArg, V: SingleArg { ... } fn hstrlen<K, F>(self, key: K, field: F) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, F: SingleArg { ... } fn hvals<K, V, A>(self, key: K) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, V: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<V> + DeserializeOwned { ... }
}
Expand description

A group of Redis commands related to Hashes

§See Also

Redis Hash Commands

Provided Methods§

Source

fn hdel<K, F, C>(self, key: K, fields: C) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, F: SingleArg, C: SingleArgCollection<F>,

Removes the specified fields from the hash stored at key.

§Return

the number of fields that were removed from the hash, not including specified but non existing fields.

§See Also

https://redis.io/commands/hdel/

Source

fn hexists<K, F>(self, key: K, field: F) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg, F: SingleArg,

Returns if field is an existing field in the hash stored at key.

§Return
  • true - if the hash contains field.
  • false - if the hash does not contain field, or key does not exist.
§See Also

https://redis.io/commands/hexists/

Source

fn hget<K, F, V>(self, key: K, field: F) -> PreparedCommand<'a, Self, V>
where Self: Sized, K: SingleArg, F: SingleArg, V: PrimitiveResponse,

Returns the value associated with field in the hash stored at key.

§Return

The value associated with field, or nil when field is not present in the hash or key does not exist.

§See Also

https://redis.io/commands/hget/

Source

fn hgetall<K, F, V, A>(self, key: K) -> PreparedCommand<'a, Self, A>

Returns all fields and values of the hash stored at key.

§Return

The list of fields and their values stored in the hash, or an empty list when key does not exist.

§See Also

https://redis.io/commands/hgetall/

Source

fn hincrby<K, F>( self, key: K, field: F, increment: i64, ) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg, F: SingleArg,

Increments the number stored at field in the hash stored at key by increment.

§Return

The value at field after the increment operation.

§See Also

https://redis.io/commands/hincrby/

Source

fn hincrbyfloat<K, F>( self, key: K, field: F, increment: f64, ) -> PreparedCommand<'a, Self, f64>
where Self: Sized, K: SingleArg, F: SingleArg,

Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.

§Return

The value at field after the increment operation.

§See Also

https://redis.io/commands/hincrbyfloat/

Source

fn hkeys<K, F, A>(self, key: K) -> PreparedCommand<'a, Self, A>

Returns all field names in the hash stored at key.

§Return

The list of fields in the hash, or an empty list when key does not exist.

§See Also

https://redis.io/commands/hkeys/

Source

fn hlen<K>(self, key: K) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg,

Returns the number of fields contained in the hash stored at key.

§Return

The number of fields in the hash, or 0 when key does not exist.

§See Also

https://redis.io/commands/hlen/

Source

fn hmget<K, F, V, C, A>(self, key: K, fields: C) -> PreparedCommand<'a, Self, A>

Returns the values associated with the specified fields in the hash stored at key.

§Return

The list of values associated with the given fields, in the same order as they are requested.

§See Also

https://redis.io/commands/hmget/

Source

fn hrandfield<K, F>(self, key: K) -> PreparedCommand<'a, Self, F>
where Self: Sized, K: SingleArg, F: PrimitiveResponse,

return random fields from the hash value stored at key.

§Return
  • When called with just the key argument, return a random field from the hash value stored at key.
§See Also

https://redis.io/commands/hrandfield/

Source

fn hrandfields<K, F, A>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, A>

return random fields from the hash value stored at key.

§Return
  • If the provided count argument is positive, return an array of distinct fields. The array’s length is either count or the hash’s number of fields (HLEN), whichever is lower.
  • If called with a negative count, the behavior changes and the command is allowed to return the same field multiple times. In this case, the number of returned fields is the absolute value of the specified count.
§See Also

https://redis.io/commands/hrandfield/

Source

fn hrandfields_with_values<K, F, V, A>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, A>

return random fields from the hash value stored at key.

§Return
  • If the provided count argument is positive, return an array of distinct fields. The array’s length is either count or the hash’s number of fields (HLEN), whichever is lower.
  • If called with a negative count, the behavior changes and the command is allowed to return the same field multiple times. In this case, the number of returned fields is the absolute value of the specified count. The optional WITHVALUES modifier changes the reply so it includes the respective values of the randomly selected hash fields.
§See Also

https://redis.io/commands/hrandfield/

Source

fn hscan<K, F, V>( self, key: K, cursor: u64, options: HScanOptions, ) -> PreparedCommand<'a, Self, HScanResult<F, V>>

Iterates fields of Hash types and their associated values.

§Return

array of elements contain two elements, a field and a value, for every returned element of the Hash.

§See Also

https://redis.io/commands/hlen/

Source

fn hset<K, F, V, I>(self, key: K, items: I) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, F: SingleArg, V: SingleArg, I: KeyValueArgsCollection<F, V>,

Sets field in the hash stored at key to value.

§Return

The number of fields that were added.

§See Also

https://redis.io/commands/hset/

Source

fn hsetnx<K, F, V>( self, key: K, field: F, value: V, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg, F: SingleArg, V: SingleArg,

Sets field in the hash stored at key to value, only if field does not yet exist.

§Return
  • true - if field is a new field in the hash and value was set.
  • false - if field already exists in the hash and no operation was performed.
§See Also

https://redis.io/commands/hsetnx/

Source

fn hstrlen<K, F>(self, key: K, field: F) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, F: SingleArg,

Returns the string length of the value associated with field in the hash stored at key.

§Return

the string length of the value associated with field, or zero when field is not present in the hash or key does not exist at all.

§See Also

https://redis.io/commands/hstrlen/

Source

fn hvals<K, V, A>(self, key: K) -> PreparedCommand<'a, Self, A>

list of values in the hash, or an empty list when key does not exist.

§Return

The list of values in the hash, or an empty list when key does not exist.

§See Also

https://redis.io/commands/hvals/

Implementors§

Source§

impl<'a> HashCommands<'a> for &'a Client

Source§

impl<'a> HashCommands<'a> for &'a mut Transaction

Source§

impl<'a, 'b> HashCommands<'a> for &'a mut Pipeline<'b>