Class ReactiveJsonCommandsImpl<K>
- java.lang.Object
-
- io.quarkus.redis.runtime.datasource.AbstractRedisCommands
-
- io.quarkus.redis.runtime.datasource.AbstractJsonCommands<K>
-
- io.quarkus.redis.runtime.datasource.ReactiveJsonCommandsImpl<K>
-
- All Implemented Interfaces:
ReactiveJsonCommands<K>
,ReactiveRedisCommands
public class ReactiveJsonCommandsImpl<K> extends AbstractJsonCommands<K> implements ReactiveJsonCommands<K>
-
-
Field Summary
-
Fields inherited from class io.quarkus.redis.runtime.datasource.AbstractRedisCommands
marshaller, redis
-
-
Constructor Summary
Constructors Constructor Description ReactiveJsonCommandsImpl(ReactiveRedisDataSourceImpl redis, Class<K> k)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static <T> List<T>
decodeArrPopResponse(Class<T> clazz, io.vertx.mutiny.redis.client.Response r)
(package private) static List<Integer>
decodeAsListOfInteger(io.vertx.mutiny.redis.client.Response r)
(package private) static List<io.vertx.core.json.JsonArray>
decodeMGetResponse(io.vertx.mutiny.redis.client.Response r)
(package private) static List<List<String>>
decodeObjKeysResponse(io.vertx.mutiny.redis.client.Response r)
(package private) static List<Boolean>
decodeToggleResponse(io.vertx.mutiny.redis.client.Response r)
(package private) static List<String>
decodeTypeResponse(io.vertx.mutiny.redis.client.Response r)
ReactiveRedisDataSource
getDataSource()
<T> io.smallrye.mutiny.Uni<List<Integer>>
jsonArrAppend(K key, String path, T... values)
Execute the command JSON.ARRAPPEND.<T> io.smallrye.mutiny.Uni<List<Integer>>
jsonArrIndex(K key, String path, T value, int start, int end)
Execute the command JSON.ARRINDEX.<T> io.smallrye.mutiny.Uni<List<Integer>>
jsonArrInsert(K key, String path, int index, T... values)
Execute the command JSON.ARRINSERT.io.smallrye.mutiny.Uni<List<Integer>>
jsonArrLen(K key, String path)
Execute the command JSON.ARRLEN.<T> io.smallrye.mutiny.Uni<List<T>>
jsonArrPop(K key, Class<T> clazz, String path, int index)
Execute the command JSON.ARRPOP.io.smallrye.mutiny.Uni<List<Integer>>
jsonArrTrim(K key, String path, int start, int stop)
Execute the command JSON.ARRTRIM.io.smallrye.mutiny.Uni<Integer>
jsonClear(K key, String path)
Execute the command JSON.CLEAR.io.smallrye.mutiny.Uni<Integer>
jsonDel(K key, String path)
Execute the command JSON.DEL.<T> io.smallrye.mutiny.Uni<T>
jsonGet(K key, Class<T> clazz)
Execute the command JSON.GET.io.smallrye.mutiny.Uni<io.vertx.core.json.JsonArray>
jsonGet(K key, String path)
Execute the command JSON.GET.io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject>
jsonGet(K key, String... paths)
Execute the command JSON.GET.io.smallrye.mutiny.Uni<io.vertx.core.json.JsonArray>
jsonGetArray(K key)
Execute the command JSON.GET.io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject>
jsonGetObject(K key)
Execute the command JSON.GET.io.smallrye.mutiny.Uni<List<io.vertx.core.json.JsonArray>>
jsonMget(String path, K... keys)
Execute the command JSON.MGET.io.smallrye.mutiny.Uni<Void>
jsonNumincrby(K key, String path, double value)
Execute the command JSON.NUMINCRBY.io.smallrye.mutiny.Uni<List<List<String>>>
jsonObjKeys(K key, String path)
Execute the command JSON.OBJKEYS.io.smallrye.mutiny.Uni<List<Integer>>
jsonObjLen(K key, String path)
Execute the command JSON.OBJLEN.io.smallrye.mutiny.Uni<Void>
jsonSet(K key, String path, io.vertx.core.json.JsonArray json)
Execute the command JSON.SET.io.smallrye.mutiny.Uni<Void>
jsonSet(K key, String path, io.vertx.core.json.JsonArray json, JsonSetArgs args)
Execute the command JSON.SET.io.smallrye.mutiny.Uni<Void>
jsonSet(K key, String path, io.vertx.core.json.JsonObject json)
Execute the command JSON.SET.io.smallrye.mutiny.Uni<Void>
jsonSet(K key, String path, io.vertx.core.json.JsonObject json, JsonSetArgs args)
Execute the command JSON.SET.<T> io.smallrye.mutiny.Uni<Void>
jsonSet(K key, String path, T value)
Execute the command JSON.SET.<T> io.smallrye.mutiny.Uni<Void>
jsonSet(K key, String path, T value, JsonSetArgs args)
Execute the command JSON.SET.io.smallrye.mutiny.Uni<List<Integer>>
jsonStrAppend(K key, String path, String value)
Execute the command JSON.STRAPPEND.io.smallrye.mutiny.Uni<List<Integer>>
jsonStrLen(K key, String path)
Execute the command JSON.STRLEN.io.smallrye.mutiny.Uni<List<Boolean>>
jsonToggle(K key, String path)
Execute the command JSON.TOGGLE.io.smallrye.mutiny.Uni<List<String>>
jsonType(K key, String path)
Execute the command JSON.TYPE.-
Methods inherited from class io.quarkus.redis.runtime.datasource.AbstractJsonCommands
_jsonArrAppend, _jsonArrIndex, _jsonArrInsert, _jsonArrLen, _jsonArrPop, _jsonArrTrim, _jsonClear, _jsonDel, _jsonGet, _jsonGet, _jsonGet, _jsonMget, _jsonNumincrby, _jsonObjKeys, _jsonObjLen, _jsonSet, _jsonSet, _jsonSet, _jsonSet, _jsonSet, _jsonSet, _jsonSet, _jsonStrAppend, _jsonStrLen, _jsonToggle, _jsonType
-
Methods inherited from class io.quarkus.redis.runtime.datasource.AbstractRedisCommands
execute
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.quarkus.redis.datasource.json.ReactiveJsonCommands
jsonArrIndex, jsonArrLen, jsonArrPop, jsonClear, jsonDel, jsonObjKeys, jsonObjLen
-
-
-
-
Constructor Detail
-
ReactiveJsonCommandsImpl
public ReactiveJsonCommandsImpl(ReactiveRedisDataSourceImpl redis, Class<K> k)
-
-
Method Detail
-
getDataSource
public ReactiveRedisDataSource getDataSource()
- Specified by:
getDataSource
in interfaceReactiveRedisCommands
- Returns:
- the data source.
-
jsonSet
public <T> io.smallrye.mutiny.Uni<Void> jsonSet(K key, String path, T value)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.SET. Summary: Sets the JSON value at path in key. Group: json- Specified by:
jsonSet
in interfaceReactiveJsonCommands<K>
- Type Parameters:
T
- the type for the value- Parameters:
key
- the key, must not benull
path
- the path, must not benull
value
- the value, encoded to JSON- Returns:
- A uni emitting
null
when the operation completes
-
jsonSet
public io.smallrye.mutiny.Uni<Void> jsonSet(K key, String path, io.vertx.core.json.JsonObject json)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.SET. Summary: Sets the JSON value at path in key. Group: json- Specified by:
jsonSet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- the path, must not benull
json
- the JSON object to store, must not benull
- Returns:
- A uni emitting
null
when the operation completes
-
jsonSet
public io.smallrye.mutiny.Uni<Void> jsonSet(K key, String path, io.vertx.core.json.JsonObject json, JsonSetArgs args)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.SET. Summary: Sets the JSON value at path in key. Group: json- Specified by:
jsonSet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- the path, must not benull
json
- the JSON object to store, must not benull
args
- the extra arguments- Returns:
- A uni emitting
null
when the operation completes
-
jsonSet
public io.smallrye.mutiny.Uni<Void> jsonSet(K key, String path, io.vertx.core.json.JsonArray json)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.SET. Summary: Sets the JSON value at path in key. Group: json- Specified by:
jsonSet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- the path, must not benull
json
- the JSON array to store, must not benull
- Returns:
- A uni emitting
null
when the operation completes
-
jsonSet
public io.smallrye.mutiny.Uni<Void> jsonSet(K key, String path, io.vertx.core.json.JsonArray json, JsonSetArgs args)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.SET. Summary: Sets the JSON value at path in key. Group: json- Specified by:
jsonSet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- the path, must not benull
json
- the JSON array to store, must not benull
args
- the extra arguments- Returns:
- A uni emitting
null
when the operation completes
-
jsonSet
public <T> io.smallrye.mutiny.Uni<Void> jsonSet(K key, String path, T value, JsonSetArgs args)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.SET. Summary: Sets the JSON value at path in key. Group: json- Specified by:
jsonSet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- the path, must not benull
value
- the value to store, encoded to JSON.args
- the extra arguments- Returns:
- A uni emitting
null
when the operation completes
-
jsonGet
public <T> io.smallrye.mutiny.Uni<T> jsonGet(K key, Class<T> clazz)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.GET. Summary: Returns the value at path in JSON serialized form. Group: jsonThis method uses the root path (
$
). It map the retrieve JSON document to an object of type<T>
.- Specified by:
jsonGet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
clazz
- the type of object to recreate from the JSON content- Returns:
- a uni emitting the object,
null
if it does not exist
-
jsonGetObject
public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> jsonGetObject(K key)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.GET. Summary: Returns the value at path in JSON serialized form. Group: jsonThis method uses the root path (
$
). UnlikeReactiveJsonCommands.jsonGet(Object, Class)
, it returns aJsonObject
.- Specified by:
jsonGetObject
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
- Returns:
- a uni emitting the stored JSON object,
null
if it does not exist
-
jsonGetArray
public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonArray> jsonGetArray(K key)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.GET. Summary: Returns the value at path in JSON serialized form. Group: jsonThis method uses the root path (
$
). UnlikeReactiveJsonCommands.jsonGet(Object, Class)
, it returns aJsonArray
.- Specified by:
jsonGetArray
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
- Returns:
- a uni emitting the stored JSON array,
null
if it does not exist
-
jsonGet
public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonArray> jsonGet(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.GET. Summary: Returns the value at path in JSON serialized form. Group: json- Specified by:
jsonGet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- the path, must not benull
- Returns:
- a uni emitting the JSON array containing the different results,
null
if it does not exist.
-
jsonGet
public io.smallrye.mutiny.Uni<io.vertx.core.json.JsonObject> jsonGet(K key, String... paths)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.GET. Summary: Returns the value at path in JSON serialized form. Group: json- Specified by:
jsonGet
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
paths
- the paths, must not benull
. If no path are passed, this is equivalent toReactiveJsonCommands.jsonGetObject(Object)
, if multiple paths are passed, the produced JSON object contains the result (as a json array) for each path.- Returns:
- a uni emitting the stored JSON object,
null
if it does not exist. If no path are passed, this is equivalent toReactiveJsonCommands.jsonGetObject(Object)
. If multiple paths are passed, the produced JSON object contains the result for each pass as a JSON array.
-
jsonArrAppend
public <T> io.smallrye.mutiny.Uni<List<Integer>> jsonArrAppend(K key, String path, T... values)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.ARRAPPEND. Summary: Append the json values into the array at path after the last element in it. Group: json- Specified by:
jsonArrAppend
in interfaceReactiveJsonCommands<K>
- Type Parameters:
T
- the type of value- Parameters:
key
- the key, must not benull
path
- the path, must not benull
values
- the values to append, encoded to JSON- Returns:
- a uni emitting a list with the new sizes of each modified array (in order) or
null
(instead of the size) if the point object was not an array.
-
jsonArrIndex
public <T> io.smallrye.mutiny.Uni<List<Integer>> jsonArrIndex(K key, String path, T value, int start, int end)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.ARRINDEX. Summary: Searches for the first occurrence of a scalar JSON value in an array. Group: json- Specified by:
jsonArrIndex
in interfaceReactiveJsonCommands<K>
- Type Parameters:
T
- the type of value- Parameters:
key
- the key, must not benull
path
- the path, must not benull
value
- the value to be searched, encoded to JSONstart
- the start indexend
- the end index- Returns:
- a uni emitting a list with the first position in the array of each JSON value that matches the path,
-1
if not found in the array, ornull
if the matching JSON value is not an array.
-
decodeAsListOfInteger
static List<Integer> decodeAsListOfInteger(io.vertx.mutiny.redis.client.Response r)
-
jsonArrInsert
public <T> io.smallrye.mutiny.Uni<List<Integer>> jsonArrInsert(K key, String path, int index, T... values)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.ARRINSERT. Summary: Inserts the json values into the array at path before the index (shifts to the right). Group: json- Specified by:
jsonArrInsert
in interfaceReactiveJsonCommands<K>
- Type Parameters:
T
- the type of value- Parameters:
key
- the key, must not benull
path
- the path, must not benull
index
- the index. 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
- the values to insert, encoded to JSON- Returns:
- a uni emitting a list of integer containing for each path, the array's new size or
null
if the matching JSON value is not an array.
-
jsonArrLen
public io.smallrye.mutiny.Uni<List<Integer>> jsonArrLen(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.ARRLEN. Summary: Reports the length of the JSON Array at path in key. Group: json- Specified by:
jsonArrLen
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- the path,null
means$
- Returns:
- a uni emitting a list of integer containing for each path, the array's length, or @{code null} if the matching JSON value is not an array.
-
jsonArrPop
public <T> io.smallrye.mutiny.Uni<List<T>> jsonArrPop(K key, Class<T> clazz, String path, int index)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.ARRPOP. Summary: Removes and returns an element from the index in the array. Group: json- Specified by:
jsonArrPop
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
clazz
- the type of the popped objectpath
- path the path, defaults to root if not provided.index
- is the position in the array to start popping from (defaults to -1, meaning the last element). Out-of-range indexes round to their respective array ends.- Returns:
- a uni emitting a list of T including for each path, an instance of T rebuilt from the JSON value, or
null
if the matching JSON value is not an array. Popping an empty array producesnull
.
-
decodeArrPopResponse
static <T> List<T> decodeArrPopResponse(Class<T> clazz, io.vertx.mutiny.redis.client.Response r)
-
jsonArrTrim
public io.smallrye.mutiny.Uni<List<Integer>> jsonArrTrim(K key, String path, int start, int stop)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.ARRTRIM. Summary: Trims an array so that it contains only the specified inclusive range of elements. Group: json- Specified by:
jsonArrTrim
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, must not benull
start
- the start indexstop
- the stop index- Returns:
- a uni emitting a list of integer containing, for each path, the array's new size, or
null
if the matching JSON value is not an array.
-
jsonClear
public io.smallrye.mutiny.Uni<Integer> jsonClear(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.CLEAR. Summary: Clears container values (Arrays/Objects), and sets numeric values to 0. Group: json- Specified by:
jsonClear
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided. Non-existing paths are ignored.- Returns:
- a uni emitting the number of value cleared
-
jsonDel
public io.smallrye.mutiny.Uni<Integer> jsonDel(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.DEL. Summary: Deletes a value. Group: json- Specified by:
jsonDel
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided. Non-existing paths are ignored.- Returns:
- a uni emitting the number of path deleted
-
jsonMget
public io.smallrye.mutiny.Uni<List<io.vertx.core.json.JsonArray>> jsonMget(String path, K... keys)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.MGET. Summary: Returns the values at path from multiple key arguments. Returnsnull
for nonexistent keys and nonexistent paths. Group: json- Specified by:
jsonMget
in interfaceReactiveJsonCommands<K>
- Parameters:
path
- path the pathkeys
- the keys, must not benull
, must not containnull
- Returns:
- a uni emitting a list of JsonArray containing each retrieved value
-
decodeMGetResponse
static List<io.vertx.core.json.JsonArray> decodeMGetResponse(io.vertx.mutiny.redis.client.Response r)
-
jsonNumincrby
public io.smallrye.mutiny.Uni<Void> jsonNumincrby(K key, String path, double value)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.NUMINCRBY. Summary: Increments the number value stored at path by number. Group: json- Specified by:
jsonNumincrby
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided. Non-existing paths are ignored.value
- the value to add- Returns:
- a uni emitting
null
when the operation completes
-
jsonObjKeys
public io.smallrye.mutiny.Uni<List<List<String>>> jsonObjKeys(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.OBJKEYS. Summary: Returns the keys in the object that's referenced by path. Group: json- Specified by:
jsonObjKeys
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided.- Returns:
- a uni emitting a list containing, for each matching path, the list of keys, or
null
if the matching JSON value is not an object.
-
decodeObjKeysResponse
static List<List<String>> decodeObjKeysResponse(io.vertx.mutiny.redis.client.Response r)
-
jsonObjLen
public io.smallrye.mutiny.Uni<List<Integer>> jsonObjLen(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.OBJLEN. Summary: Reports the number of keys in the JSON Object at path in key. Group: json- Specified by:
jsonObjLen
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided.- Returns:
- a uni emitting a list containing, for each path, the length of the object,
null
if the matching JSON value is not an object
-
jsonStrAppend
public io.smallrye.mutiny.Uni<List<Integer>> jsonStrAppend(K key, String path, String value)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.STRAPPEND. Summary: Appends the json-string values to the string at path. Group: json- Specified by:
jsonStrAppend
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided.value
- the string to append, must not benull
- Returns:
- a uni emitting a list containing, for each path, the new string length,
null
if the matching JSON value is not a string.
-
jsonStrLen
public io.smallrye.mutiny.Uni<List<Integer>> jsonStrLen(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.STRLEN. Summary: Reports the length of the JSON String at path in key. Group: json- Specified by:
jsonStrLen
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided.- Returns:
- a uni emitting a list containing, for each path, the length of the string,
null
if the matching JSON value is not a string. Returnsnull
if the key or path do not exist.
-
jsonToggle
public io.smallrye.mutiny.Uni<List<Boolean>> jsonToggle(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.TOGGLE. Summary: Toggle a boolean value stored at path. Group: json- Specified by:
jsonToggle
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, must not benull
- Returns:
- a uni emitting a list containing, for each path, the new boolean value,
null
if the matching JSON value is not a boolean.
-
decodeToggleResponse
static List<Boolean> decodeToggleResponse(io.vertx.mutiny.redis.client.Response r)
-
jsonType
public io.smallrye.mutiny.Uni<List<String>> jsonType(K key, String path)
Description copied from interface:ReactiveJsonCommands
Execute the command JSON.TYPE. Summary: Reports the type of JSON value at path. Group: json- Specified by:
jsonType
in interfaceReactiveJsonCommands<K>
- Parameters:
key
- the key, must not benull
path
- path the path, path defaults to$
if not provided.- Returns:
- a uni emitting a list containing, for each path, the json type as String (string, integer, number, boolean, object, array), empty if no match.
-
-