pub trait JsonCommands<'a> {
Show 22 methods
// Provided methods
fn json_arrappend<K, P, V, VV, R>(
self,
key: K,
path: P,
values: VV,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
VV: SingleArgCollection<V>,
R: CollectionResponse<Option<usize>> { ... }
fn json_arrindex<K, P, V, R>(
self,
key: K,
path: P,
value: V,
options: JsonArrIndexOptions,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
R: CollectionResponse<Option<isize>> { ... }
fn json_arrinsert<K, P, V, VV, R>(
self,
key: K,
path: P,
index: isize,
values: VV,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
VV: SingleArgCollection<V>,
R: CollectionResponse<Option<usize>> { ... }
fn json_arrlen<K, P, R>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: CollectionResponse<Option<usize>> { ... }
fn json_arrpop<K, P, R, RR>(
self,
key: K,
path: P,
index: isize,
) -> PreparedCommand<'a, Self, RR>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: PrimitiveResponse + DeserializeOwned,
RR: CollectionResponse<R> { ... }
fn json_arrtrim<K, P, R>(
self,
key: K,
path: P,
start: isize,
stop: isize,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: CollectionResponse<Option<usize>> { ... }
fn json_clear<K, P>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, usize>
where Self: Sized,
K: SingleArg,
P: SingleArg { ... }
fn json_debug_memory<K, P, R>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: CollectionResponse<usize> { ... }
fn json_del<K, P>(self, key: K, path: P) -> PreparedCommand<'a, Self, usize>
where Self: Sized,
K: SingleArg,
P: SingleArg { ... }
fn json_forget<K, P>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, usize>
where Self: Sized,
K: SingleArg,
P: SingleArg { ... }
fn json_get<K, V>(
self,
key: K,
options: JsonGetOptions,
) -> PreparedCommand<'a, Self, V>
where Self: Sized,
K: SingleArg,
V: PrimitiveResponse { ... }
fn json_mget<K, KK, P, V, VV>(
self,
keys: KK,
path: P,
) -> PreparedCommand<'a, Self, VV>
where Self: Sized,
K: SingleArg,
KK: SingleArgCollection<K>,
P: SingleArg,
V: PrimitiveResponse + DeserializeOwned,
VV: CollectionResponse<V> { ... }
fn json_numincrby<K, P, V, R>(
self,
key: K,
path: P,
value: V,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
R: PrimitiveResponse { ... }
fn json_nummultby<K, P, V, R>(
self,
key: K,
path: P,
value: V,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
R: PrimitiveResponse { ... }
fn json_objkeys<K, P, R, RR>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, RR>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: PrimitiveResponse + DeserializeOwned,
RR: CollectionResponse<Vec<R>> { ... }
fn json_objlen<K, P, R>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: CollectionResponse<Option<usize>> { ... }
fn json_resp<K, P, VV>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, VV>
where Self: Sized,
K: SingleArg,
P: SingleArg,
VV: CollectionResponse<Value> { ... }
fn json_set<K, P, V>(
self,
key: K,
path: P,
value: V,
condition: SetCondition,
) -> PreparedCommand<'a, Self, ()>
where Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg { ... }
fn json_strappend<K, P, V, R>(
self,
key: K,
path: P,
value: V,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
R: CollectionResponse<Option<usize>> { ... }
fn json_strlen<K, P, R>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: CollectionResponse<Option<usize>> { ... }
fn json_toggle<K, P, R>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, R>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: CollectionResponse<Option<usize>> { ... }
fn json_type<K, P, R, RR>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, RR>
where Self: Sized,
K: SingleArg,
P: SingleArg,
R: PrimitiveResponse + DeserializeOwned,
RR: CollectionResponse<R> { ... }
}
redis-json
only.Expand description
Provided Methods§
Sourcefn json_arrappend<K, P, V, VV, R>(
self,
key: K,
path: P,
values: VV,
) -> PreparedCommand<'a, Self, R>where
Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
VV: SingleArgCollection<V>,
R: CollectionResponse<Option<usize>>,
fn json_arrappend<K, P, V, VV, R>(
self,
key: K,
path: P,
values: VV,
) -> PreparedCommand<'a, Self, R>where
Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
VV: SingleArgCollection<V>,
R: CollectionResponse<Option<usize>>,
Append the json values
into the array at path
after the last element in it
§Arguments
key
- The key to modify.path
- The JSONPath to specify.values
- one or more values to append to one or more arrays.
§Return
A collection of integer replies for each path, the array’s new size, or nil, if the matching JSON value is not an array.
§See Also
Sourcefn json_arrindex<K, P, V, R>(
self,
key: K,
path: P,
value: V,
options: JsonArrIndexOptions,
) -> PreparedCommand<'a, Self, R>
fn json_arrindex<K, P, V, R>( self, key: K, path: P, value: V, options: JsonArrIndexOptions, ) -> PreparedCommand<'a, Self, R>
Search for the first occurrence of a scalar JSON value in an array
§Arguments
key
- The key to parse.path
- The JSONPath to specify.value
- value index to find in one or more arrays.
§Return
A collection of integer replies for each path,
the first position in the array of each JSON value that matches the path, -1 if unfound in the array, or nil, if the matching JSON value is not an array.
§See Also
Sourcefn json_arrinsert<K, P, V, VV, R>(
self,
key: K,
path: P,
index: isize,
values: VV,
) -> PreparedCommand<'a, Self, R>where
Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
VV: SingleArgCollection<V>,
R: CollectionResponse<Option<usize>>,
fn json_arrinsert<K, P, V, VV, R>(
self,
key: K,
path: P,
index: isize,
values: VV,
) -> PreparedCommand<'a, Self, R>where
Self: Sized,
K: SingleArg,
P: SingleArg,
V: SingleArg,
VV: SingleArgCollection<V>,
R: CollectionResponse<Option<usize>>,
Insert the json values
into the array at path
before the index
(shifts to the right)
§Arguments
key
- The key to modify.path
- The JSONPath to specify.index
- The position in the array where you want to insert a value. The index must be in the array’s range. Inserting at index 0 prepends to the array. Negative index values start from the end of the array.values
- one or more values to insert in one or more arrays.
§Return
A collection of integer replies for each path, the array’s new size, or nil, if the matching JSON value is not an array.
§See Also
Sourcefn json_arrlen<K, P, R>(self, key: K, path: P) -> PreparedCommand<'a, Self, R>
fn json_arrlen<K, P, R>(self, key: K, path: P) -> PreparedCommand<'a, Self, R>
Sourcefn json_arrpop<K, P, R, RR>(
self,
key: K,
path: P,
index: isize,
) -> PreparedCommand<'a, Self, RR>where
Self: Sized,
K: SingleArg,
P: SingleArg,
R: PrimitiveResponse + DeserializeOwned,
RR: CollectionResponse<R>,
fn json_arrpop<K, P, R, RR>(
self,
key: K,
path: P,
index: isize,
) -> PreparedCommand<'a, Self, RR>where
Self: Sized,
K: SingleArg,
P: SingleArg,
R: PrimitiveResponse + DeserializeOwned,
RR: CollectionResponse<R>,
Remove and return an element from the index in the array
§Arguments
key
- The key to modify.path
- The JSONPath to specify.index
- is position in the array to start popping from. Default is -1, meaning the last element. Out-of-range indexes round to their respective array ends. Popping an empty array returns null.
§Return
A collection of bulk string replies for each path, each reply is the popped JSON value, or nil, if the matching JSON value is not an array.
§See Also
Sourcefn json_arrtrim<K, P, R>(
self,
key: K,
path: P,
start: isize,
stop: isize,
) -> PreparedCommand<'a, Self, R>
fn json_arrtrim<K, P, R>( self, key: K, path: P, start: isize, stop: isize, ) -> PreparedCommand<'a, Self, R>
Remove and return an element from the index in the array
§Arguments
key
- The key to modify.path
- The JSONPath to specify.start
- The index of the first element to keep (previous elements are trimmed).stop
- the index of the last element to keep (following elements are trimmed), including the last element. Negative values are interpreted as starting from the end.
§Return
A collection of integer replies for each path, the array’s new size, or nil, if the matching JSON value is not an array.
§See Also
Sourcefn json_clear<K, P>(self, key: K, path: P) -> PreparedCommand<'a, Self, usize>
fn json_clear<K, P>(self, key: K, path: P) -> PreparedCommand<'a, Self, usize>
Sourcefn json_debug_memory<K, P, R>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, R>
fn json_debug_memory<K, P, R>( self, key: K, path: P, ) -> PreparedCommand<'a, Self, R>
Sourcefn json_del<K, P>(self, key: K, path: P) -> PreparedCommand<'a, Self, usize>
fn json_del<K, P>(self, key: K, path: P) -> PreparedCommand<'a, Self, usize>
Sourcefn json_forget<K, P>(self, key: K, path: P) -> PreparedCommand<'a, Self, usize>
fn json_forget<K, P>(self, key: K, path: P) -> PreparedCommand<'a, Self, usize>
Sourcefn json_get<K, V>(
self,
key: K,
options: JsonGetOptions,
) -> PreparedCommand<'a, Self, V>
fn json_get<K, V>( self, key: K, options: JsonGetOptions, ) -> PreparedCommand<'a, Self, V>
Return the value at path in JSON serialized form
§Arguments
key
- The key to parse.options
- SeeJsonOptions
§Return
A collection of bulk string replies. Each string is the JSON serialization of each JSON value that matches a path
§See Also
Sourcefn json_mget<K, KK, P, V, VV>(
self,
keys: KK,
path: P,
) -> PreparedCommand<'a, Self, VV>where
Self: Sized,
K: SingleArg,
KK: SingleArgCollection<K>,
P: SingleArg,
V: PrimitiveResponse + DeserializeOwned,
VV: CollectionResponse<V>,
fn json_mget<K, KK, P, V, VV>(
self,
keys: KK,
path: P,
) -> PreparedCommand<'a, Self, VV>where
Self: Sized,
K: SingleArg,
KK: SingleArgCollection<K>,
P: SingleArg,
V: PrimitiveResponse + DeserializeOwned,
VV: CollectionResponse<V>,
Return the values at path
from multiple key
arguments
§Arguments
key
- The key to parse.options
- SeeJsonOptions
§Return
A collection of bulk string replies specified as the JSON serialization of the value at each key’s path.
§See Also
Sourcefn json_numincrby<K, P, V, R>(
self,
key: K,
path: P,
value: V,
) -> PreparedCommand<'a, Self, R>
fn json_numincrby<K, P, V, R>( self, key: K, path: P, value: V, ) -> PreparedCommand<'a, Self, R>
Sourcefn json_nummultby<K, P, V, R>(
self,
key: K,
path: P,
value: V,
) -> PreparedCommand<'a, Self, R>
fn json_nummultby<K, P, V, R>( self, key: K, path: P, value: V, ) -> PreparedCommand<'a, Self, R>
Sourcefn json_objkeys<K, P, R, RR>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, RR>where
Self: Sized,
K: SingleArg,
P: SingleArg,
R: PrimitiveResponse + DeserializeOwned,
RR: CollectionResponse<Vec<R>>,
fn json_objkeys<K, P, R, RR>(
self,
key: K,
path: P,
) -> PreparedCommand<'a, Self, RR>where
Self: Sized,
K: SingleArg,
P: SingleArg,
R: PrimitiveResponse + DeserializeOwned,
RR: CollectionResponse<Vec<R>>,
Return the keys in the object that’s referenced by path
§Arguments
key
- The key to parse.path
- The JSONPath to specify.
§Return
A collection of collection replies for each path, a collection of the key names in the object as a bulk string reply, or an empty collection if the matching JSON value is not an object.
§See Also
Sourcefn json_objlen<K, P, R>(self, key: K, path: P) -> PreparedCommand<'a, Self, R>
fn json_objlen<K, P, R>(self, key: K, path: P) -> PreparedCommand<'a, Self, R>
Sourcefn json_resp<K, P, VV>(self, key: K, path: P) -> PreparedCommand<'a, Self, VV>
fn json_resp<K, P, VV>(self, key: K, path: P) -> PreparedCommand<'a, Self, VV>
Return the JSON in key in
Redis serialization protocol specification
form
§Arguments
key
- The key to parse.path
- The JSONPath to specify.
§Return
A collection of Values
This command uses the following mapping from JSON to RESP:
- JSON
null
maps to the bulk string reply. - JSON
false
andtrue
values map to the simple string reply. - JSON number maps to the integer reply or bulk string reply, depending on type.
- JSON string maps to the bulk string reply.
- JSON array is represented as an array reply in which the first element is the simple string reply
[
, followed by the array’s elements. - JSON object is represented as an array reply in which the first element is the simple string reply
{
. Each successive entry represents a key-value pair as a two-entry array reply of the bulk string reply.
§See Also
Sourcefn json_set<K, P, V>(
self,
key: K,
path: P,
value: V,
condition: SetCondition,
) -> PreparedCommand<'a, Self, ()>
fn json_set<K, P, V>( self, key: K, path: P, value: V, condition: SetCondition, ) -> PreparedCommand<'a, Self, ()>
Set the JSON value at path
in key
§Arguments
key
- The key to modify.path
- JSONPath to specify.
For new Redis keys the path must be the root.
For existing keys, when the entire path exists, the value that it contains is replaced with the json value.
For existing keys, when the path exists, except for the last element, a new child is added with the json value.value
- The value to set at the specified pathcondition
- SeeSetCondition