{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Database.Redis.ManualCommands.JSON where
import Data.ByteString (ByteString)
import Data.List.NonEmpty (NonEmpty(..))
import qualified Data.List.NonEmpty as NE
import Database.Redis.Core
import Database.Redis.Protocol
import Database.Redis.Types
data JSONGetOpts = JSONGetOpts
{ JSONGetOpts -> Maybe ByteString
jsonGetIndent :: Maybe ByteString
, JSONGetOpts -> Maybe ByteString
jsonGetNewline :: Maybe ByteString
, JSONGetOpts -> Maybe ByteString
jsonGetSpace :: Maybe ByteString
, JSONGetOpts -> [ByteString]
jsonGetPaths :: [ByteString]
} deriving (Int -> JSONGetOpts -> ShowS
[JSONGetOpts] -> ShowS
JSONGetOpts -> String
(Int -> JSONGetOpts -> ShowS)
-> (JSONGetOpts -> String)
-> ([JSONGetOpts] -> ShowS)
-> Show JSONGetOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JSONGetOpts -> ShowS
showsPrec :: Int -> JSONGetOpts -> ShowS
$cshow :: JSONGetOpts -> String
show :: JSONGetOpts -> String
$cshowList :: [JSONGetOpts] -> ShowS
showList :: [JSONGetOpts] -> ShowS
Show, JSONGetOpts -> JSONGetOpts -> Bool
(JSONGetOpts -> JSONGetOpts -> Bool)
-> (JSONGetOpts -> JSONGetOpts -> Bool) -> Eq JSONGetOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JSONGetOpts -> JSONGetOpts -> Bool
== :: JSONGetOpts -> JSONGetOpts -> Bool
$c/= :: JSONGetOpts -> JSONGetOpts -> Bool
/= :: JSONGetOpts -> JSONGetOpts -> Bool
Eq)
defaultJSONGetOpts :: JSONGetOpts
defaultJSONGetOpts :: JSONGetOpts
defaultJSONGetOpts = JSONGetOpts
{ jsonGetIndent :: Maybe ByteString
jsonGetIndent = Maybe ByteString
forall a. Maybe a
Nothing
, jsonGetNewline :: Maybe ByteString
jsonGetNewline = Maybe ByteString
forall a. Maybe a
Nothing
, jsonGetSpace :: Maybe ByteString
jsonGetSpace = Maybe ByteString
forall a. Maybe a
Nothing
, jsonGetPaths :: [ByteString]
jsonGetPaths = []
}
data JSONSetCondition
= JSONSetIfNotExists
| JSONSetIfExists
deriving (Int -> JSONSetCondition -> ShowS
[JSONSetCondition] -> ShowS
JSONSetCondition -> String
(Int -> JSONSetCondition -> ShowS)
-> (JSONSetCondition -> String)
-> ([JSONSetCondition] -> ShowS)
-> Show JSONSetCondition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JSONSetCondition -> ShowS
showsPrec :: Int -> JSONSetCondition -> ShowS
$cshow :: JSONSetCondition -> String
show :: JSONSetCondition -> String
$cshowList :: [JSONSetCondition] -> ShowS
showList :: [JSONSetCondition] -> ShowS
Show, JSONSetCondition -> JSONSetCondition -> Bool
(JSONSetCondition -> JSONSetCondition -> Bool)
-> (JSONSetCondition -> JSONSetCondition -> Bool)
-> Eq JSONSetCondition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JSONSetCondition -> JSONSetCondition -> Bool
== :: JSONSetCondition -> JSONSetCondition -> Bool
$c/= :: JSONSetCondition -> JSONSetCondition -> Bool
/= :: JSONSetCondition -> JSONSetCondition -> Bool
Eq)
instance RedisArg JSONSetCondition where
encode :: JSONSetCondition -> ByteString
encode JSONSetCondition
JSONSetIfNotExists = ByteString
"NX"
encode JSONSetCondition
JSONSetIfExists = ByteString
"XX"
data JSONSetFPHA
= JSONSetFP16
| JSONSetBF16
| JSONSetFP32
| JSONSetFP64
deriving (Int -> JSONSetFPHA -> ShowS
[JSONSetFPHA] -> ShowS
JSONSetFPHA -> String
(Int -> JSONSetFPHA -> ShowS)
-> (JSONSetFPHA -> String)
-> ([JSONSetFPHA] -> ShowS)
-> Show JSONSetFPHA
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JSONSetFPHA -> ShowS
showsPrec :: Int -> JSONSetFPHA -> ShowS
$cshow :: JSONSetFPHA -> String
show :: JSONSetFPHA -> String
$cshowList :: [JSONSetFPHA] -> ShowS
showList :: [JSONSetFPHA] -> ShowS
Show, JSONSetFPHA -> JSONSetFPHA -> Bool
(JSONSetFPHA -> JSONSetFPHA -> Bool)
-> (JSONSetFPHA -> JSONSetFPHA -> Bool) -> Eq JSONSetFPHA
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JSONSetFPHA -> JSONSetFPHA -> Bool
== :: JSONSetFPHA -> JSONSetFPHA -> Bool
$c/= :: JSONSetFPHA -> JSONSetFPHA -> Bool
/= :: JSONSetFPHA -> JSONSetFPHA -> Bool
Eq)
instance RedisArg JSONSetFPHA where
encode :: JSONSetFPHA -> ByteString
encode JSONSetFPHA
JSONSetFP16 = ByteString
"FP16"
encode JSONSetFPHA
JSONSetBF16 = ByteString
"BF16"
encode JSONSetFPHA
JSONSetFP32 = ByteString
"FP32"
encode JSONSetFPHA
JSONSetFP64 = ByteString
"FP64"
data JSONSetOpts = JSONSetOpts
{ JSONSetOpts -> Maybe JSONSetCondition
jsonSetCondition :: Maybe JSONSetCondition
, JSONSetOpts -> Maybe JSONSetFPHA
jsonSetFPHA :: Maybe JSONSetFPHA
} deriving (Int -> JSONSetOpts -> ShowS
[JSONSetOpts] -> ShowS
JSONSetOpts -> String
(Int -> JSONSetOpts -> ShowS)
-> (JSONSetOpts -> String)
-> ([JSONSetOpts] -> ShowS)
-> Show JSONSetOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JSONSetOpts -> ShowS
showsPrec :: Int -> JSONSetOpts -> ShowS
$cshow :: JSONSetOpts -> String
show :: JSONSetOpts -> String
$cshowList :: [JSONSetOpts] -> ShowS
showList :: [JSONSetOpts] -> ShowS
Show, JSONSetOpts -> JSONSetOpts -> Bool
(JSONSetOpts -> JSONSetOpts -> Bool)
-> (JSONSetOpts -> JSONSetOpts -> Bool) -> Eq JSONSetOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JSONSetOpts -> JSONSetOpts -> Bool
== :: JSONSetOpts -> JSONSetOpts -> Bool
$c/= :: JSONSetOpts -> JSONSetOpts -> Bool
/= :: JSONSetOpts -> JSONSetOpts -> Bool
Eq)
defaultJSONSetOpts :: JSONSetOpts
defaultJSONSetOpts :: JSONSetOpts
defaultJSONSetOpts = JSONSetOpts
{ jsonSetCondition :: Maybe JSONSetCondition
jsonSetCondition = Maybe JSONSetCondition
forall a. Maybe a
Nothing
, jsonSetFPHA :: Maybe JSONSetFPHA
jsonSetFPHA = Maybe JSONSetFPHA
forall a. Maybe a
Nothing
}
data JSONArrIndexOpts
= JSONArrIndexAll
| JSONArrIndexFrom Integer
| JSONArrIndexFromTo Integer Integer
deriving (Int -> JSONArrIndexOpts -> ShowS
[JSONArrIndexOpts] -> ShowS
JSONArrIndexOpts -> String
(Int -> JSONArrIndexOpts -> ShowS)
-> (JSONArrIndexOpts -> String)
-> ([JSONArrIndexOpts] -> ShowS)
-> Show JSONArrIndexOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> JSONArrIndexOpts -> ShowS
showsPrec :: Int -> JSONArrIndexOpts -> ShowS
$cshow :: JSONArrIndexOpts -> String
show :: JSONArrIndexOpts -> String
$cshowList :: [JSONArrIndexOpts] -> ShowS
showList :: [JSONArrIndexOpts] -> ShowS
Show, JSONArrIndexOpts -> JSONArrIndexOpts -> Bool
(JSONArrIndexOpts -> JSONArrIndexOpts -> Bool)
-> (JSONArrIndexOpts -> JSONArrIndexOpts -> Bool)
-> Eq JSONArrIndexOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: JSONArrIndexOpts -> JSONArrIndexOpts -> Bool
== :: JSONArrIndexOpts -> JSONArrIndexOpts -> Bool
$c/= :: JSONArrIndexOpts -> JSONArrIndexOpts -> Bool
/= :: JSONArrIndexOpts -> JSONArrIndexOpts -> Bool
Eq)
defaultJSONArrIndexOpts :: JSONArrIndexOpts
defaultJSONArrIndexOpts :: JSONArrIndexOpts
defaultJSONArrIndexOpts = JSONArrIndexOpts
JSONArrIndexAll
jsonGetOptsToArgs :: JSONGetOpts -> [ByteString]
jsonGetOptsToArgs :: JSONGetOpts -> [ByteString]
jsonGetOptsToArgs JSONGetOpts{[ByteString]
Maybe ByteString
jsonGetIndent :: JSONGetOpts -> Maybe ByteString
jsonGetNewline :: JSONGetOpts -> Maybe ByteString
jsonGetSpace :: JSONGetOpts -> Maybe ByteString
jsonGetPaths :: JSONGetOpts -> [ByteString]
jsonGetIndent :: Maybe ByteString
jsonGetNewline :: Maybe ByteString
jsonGetSpace :: Maybe ByteString
jsonGetPaths :: [ByteString]
..} =
[ByteString]
indentArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
newlineArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
spaceArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
jsonGetPaths
where
indentArg :: [ByteString]
indentArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
indent -> [ByteString
"INDENT", ByteString
indent]) Maybe ByteString
jsonGetIndent
newlineArg :: [ByteString]
newlineArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
newline -> [ByteString
"NEWLINE", ByteString
newline]) Maybe ByteString
jsonGetNewline
spaceArg :: [ByteString]
spaceArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
space -> [ByteString
"SPACE", ByteString
space]) Maybe ByteString
jsonGetSpace
jsonSetOptsToArgs :: JSONSetOpts -> [ByteString]
jsonSetOptsToArgs :: JSONSetOpts -> [ByteString]
jsonSetOptsToArgs JSONSetOpts{Maybe JSONSetFPHA
Maybe JSONSetCondition
jsonSetCondition :: JSONSetOpts -> Maybe JSONSetCondition
jsonSetFPHA :: JSONSetOpts -> Maybe JSONSetFPHA
jsonSetCondition :: Maybe JSONSetCondition
jsonSetFPHA :: Maybe JSONSetFPHA
..} =
[ByteString]
conditionArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
fphaArg
where
conditionArg :: [ByteString]
conditionArg = [ByteString]
-> (JSONSetCondition -> [ByteString])
-> Maybe JSONSetCondition
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\JSONSetCondition
condition -> [JSONSetCondition -> ByteString
forall a. RedisArg a => a -> ByteString
encode JSONSetCondition
condition]) Maybe JSONSetCondition
jsonSetCondition
fphaArg :: [ByteString]
fphaArg = [ByteString]
-> (JSONSetFPHA -> [ByteString])
-> Maybe JSONSetFPHA
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\JSONSetFPHA
fpha -> [ByteString
"FPHA", JSONSetFPHA -> ByteString
forall a. RedisArg a => a -> ByteString
encode JSONSetFPHA
fpha]) Maybe JSONSetFPHA
jsonSetFPHA
jsonArrIndexOptsToArgs :: JSONArrIndexOpts -> [ByteString]
jsonArrIndexOptsToArgs :: JSONArrIndexOpts -> [ByteString]
jsonArrIndexOptsToArgs JSONArrIndexOpts
JSONArrIndexAll = []
jsonArrIndexOptsToArgs (JSONArrIndexFrom Integer
start) = [Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
start]
jsonArrIndexOptsToArgs (JSONArrIndexFromTo Integer
start Integer
stop) = [Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
start, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
stop]
jsonArrappend
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> NonEmpty ByteString
-> m (f Reply)
jsonArrappend :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> NonEmpty ByteString -> m (f Reply)
jsonArrappend ByteString
key ByteString
path NonEmpty ByteString
values =
[ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$ [ByteString
"JSON.ARRAPPEND", ByteString
key, ByteString
path] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
values
jsonArrindex
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> ByteString
-> m (f Reply)
jsonArrindex :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> ByteString -> m (f Reply)
jsonArrindex ByteString
key ByteString
path ByteString
value = ByteString
-> ByteString -> ByteString -> JSONArrIndexOpts -> m (f Reply)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> ByteString -> ByteString -> JSONArrIndexOpts -> m (f Reply)
jsonArrindexOpts ByteString
key ByteString
path ByteString
value JSONArrIndexOpts
defaultJSONArrIndexOpts
jsonArrindexOpts
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> ByteString
-> JSONArrIndexOpts
-> m (f Reply)
jsonArrindexOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> ByteString -> ByteString -> JSONArrIndexOpts -> m (f Reply)
jsonArrindexOpts ByteString
key ByteString
path ByteString
value JSONArrIndexOpts
opts =
[ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$ [ByteString
"JSON.ARRINDEX", ByteString
key, ByteString
path, ByteString
value] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ JSONArrIndexOpts -> [ByteString]
jsonArrIndexOptsToArgs JSONArrIndexOpts
opts
jsonArrlen
:: (RedisCtx m f)
=> ByteString
-> m (f Reply)
jsonArrlen :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
jsonArrlen ByteString
key = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.ARRLEN", ByteString
key]
jsonArrlenAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonArrlenAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonArrlenAt ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.ARRLEN", ByteString
key, ByteString
path]
jsonArrinsert
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> Integer
-> NonEmpty ByteString
-> m (f Reply)
jsonArrinsert :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> ByteString -> Integer -> NonEmpty ByteString -> m (f Reply)
jsonArrinsert ByteString
key ByteString
path Integer
index NonEmpty ByteString
values =
[ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$ [ByteString
"JSON.ARRINSERT", ByteString
key, ByteString
path, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
index] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
values
jsonArrpop
:: (RedisCtx m f)
=> ByteString
-> m (f Reply)
jsonArrpop :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
jsonArrpop ByteString
key = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.ARRPOP", ByteString
key]
jsonArrpopAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonArrpopAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonArrpopAt ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.ARRPOP", ByteString
key, ByteString
path]
jsonArrpopAtIndex
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> Integer
-> m (f Reply)
jsonArrpopAtIndex :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> Integer -> m (f Reply)
jsonArrpopAtIndex ByteString
key ByteString
path Integer
index =
[ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.ARRPOP", ByteString
key, ByteString
path, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
index]
jsonArrtrim
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> Integer
-> Integer
-> m (f Reply)
jsonArrtrim :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> Integer -> Integer -> m (f Reply)
jsonArrtrim ByteString
key ByteString
path Integer
start Integer
stop =
[ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.ARRTRIM", ByteString
key, ByteString
path, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
start, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
stop]
jsonClear
:: (RedisCtx m f)
=> ByteString
-> m (f Integer)
jsonClear :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Integer)
jsonClear ByteString
key = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.CLEAR", ByteString
key]
jsonClearAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Integer)
jsonClearAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Integer)
jsonClearAt ByteString
key ByteString
path = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.CLEAR", ByteString
key, ByteString
path]
jsonDebug
:: (RedisCtx m f)
=> m (f Reply)
jsonDebug :: forall (m :: * -> *) (f :: * -> *). RedisCtx m f => m (f Reply)
jsonDebug = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.DEBUG"]
jsonDebugMemory
:: (RedisCtx m f)
=> ByteString
-> m (f Reply)
jsonDebugMemory :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
jsonDebugMemory ByteString
key = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.DEBUG", ByteString
"MEMORY", ByteString
key]
jsonDebugMemoryAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonDebugMemoryAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonDebugMemoryAt ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.DEBUG", ByteString
"MEMORY", ByteString
key, ByteString
path]
jsonDel
:: (RedisCtx m f)
=> ByteString
-> m (f Integer)
jsonDel :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Integer)
jsonDel ByteString
key = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.DEL", ByteString
key]
jsonDelAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Integer)
jsonDelAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Integer)
jsonDelAt ByteString
key ByteString
path = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.DEL", ByteString
key, ByteString
path]
jsonForget
:: (RedisCtx m f)
=> ByteString
-> m (f Integer)
jsonForget :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Integer)
jsonForget ByteString
key = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.FORGET", ByteString
key]
jsonForgetAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Integer)
jsonForgetAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Integer)
jsonForgetAt ByteString
key ByteString
path = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.FORGET", ByteString
key, ByteString
path]
jsonGet
:: (RedisCtx m f)
=> ByteString
-> m (f (Maybe ByteString))
jsonGet :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f (Maybe ByteString))
jsonGet ByteString
key = ByteString -> JSONGetOpts -> m (f (Maybe ByteString))
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> JSONGetOpts -> m (f (Maybe ByteString))
jsonGetOpts ByteString
key JSONGetOpts
defaultJSONGetOpts
jsonGetOpts
:: (RedisCtx m f)
=> ByteString
-> JSONGetOpts
-> m (f (Maybe ByteString))
jsonGetOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> JSONGetOpts -> m (f (Maybe ByteString))
jsonGetOpts ByteString
key JSONGetOpts
opts =
[ByteString] -> m (f (Maybe ByteString))
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f (Maybe ByteString)))
-> [ByteString] -> m (f (Maybe ByteString))
forall a b. (a -> b) -> a -> b
$ [ByteString
"JSON.GET", ByteString
key] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ JSONGetOpts -> [ByteString]
jsonGetOptsToArgs JSONGetOpts
opts
jsonMerge
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> ByteString
-> m (f Status)
jsonMerge :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> ByteString -> m (f Status)
jsonMerge ByteString
key ByteString
path ByteString
value = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.MERGE", ByteString
key, ByteString
path, ByteString
value]
jsonMget
:: (RedisCtx m f)
=> NonEmpty ByteString
-> ByteString
-> m (f [Maybe ByteString])
jsonMget :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
NonEmpty ByteString -> ByteString -> m (f [Maybe ByteString])
jsonMget NonEmpty ByteString
keys ByteString
path = [ByteString] -> m (f [Maybe ByteString])
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f [Maybe ByteString]))
-> [ByteString] -> m (f [Maybe ByteString])
forall a b. (a -> b) -> a -> b
$ ByteString
"JSON.MGET" ByteString -> [ByteString] -> [ByteString]
forall a. a -> [a] -> [a]
: NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
keys [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
path]
jsonMset
:: (RedisCtx m f)
=> NonEmpty (ByteString, ByteString, ByteString)
-> m (f Status)
jsonMset :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
NonEmpty (ByteString, ByteString, ByteString) -> m (f Status)
jsonMset NonEmpty (ByteString, ByteString, ByteString)
triplets =
[ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Status)) -> [ByteString] -> m (f Status)
forall a b. (a -> b) -> a -> b
$ ByteString
"JSON.MSET" ByteString -> [ByteString] -> [ByteString]
forall a. a -> [a] -> [a]
: ((ByteString, ByteString, ByteString) -> [ByteString])
-> [(ByteString, ByteString, ByteString)] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (ByteString, ByteString, ByteString) -> [ByteString]
forall {a}. (a, a, a) -> [a]
encodeTriplet (NonEmpty (ByteString, ByteString, ByteString)
-> [(ByteString, ByteString, ByteString)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (ByteString, ByteString, ByteString)
triplets)
where
encodeTriplet :: (a, a, a) -> [a]
encodeTriplet (a
key, a
path, a
value) = [a
key, a
path, a
value]
jsonNumincrby
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> Double
-> m (f Reply)
jsonNumincrby :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> Double -> m (f Reply)
jsonNumincrby ByteString
key ByteString
path Double
value =
[ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.NUMINCRBY", ByteString
key, ByteString
path, Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
value]
jsonNummultby
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> Double
-> m (f Reply)
jsonNummultby :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> Double -> m (f Reply)
jsonNummultby ByteString
key ByteString
path Double
value =
[ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.NUMMULTBY", ByteString
key, ByteString
path, Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
value]
jsonObjkeys
:: (RedisCtx m f)
=> ByteString
-> m (f Reply)
jsonObjkeys :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
jsonObjkeys ByteString
key = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.OBJKEYS", ByteString
key]
jsonObjkeysAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonObjkeysAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonObjkeysAt ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.OBJKEYS", ByteString
key, ByteString
path]
jsonObjlen
:: (RedisCtx m f)
=> ByteString
-> m (f Reply)
jsonObjlen :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
jsonObjlen ByteString
key = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.OBJLEN", ByteString
key]
jsonObjlenAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonObjlenAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonObjlenAt ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.OBJLEN", ByteString
key, ByteString
path]
jsonResp
:: (RedisCtx m f)
=> ByteString
-> m (f Reply)
jsonResp :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
jsonResp ByteString
key = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.RESP", ByteString
key]
jsonRespAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonRespAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonRespAt ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.RESP", ByteString
key, ByteString
path]
jsonSet
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> ByteString
-> m (f (Maybe Status))
jsonSet :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> ByteString -> m (f (Maybe Status))
jsonSet ByteString
key ByteString
path ByteString
value = ByteString
-> ByteString -> ByteString -> JSONSetOpts -> m (f (Maybe Status))
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> ByteString -> ByteString -> JSONSetOpts -> m (f (Maybe Status))
jsonSetOpts ByteString
key ByteString
path ByteString
value JSONSetOpts
defaultJSONSetOpts
jsonSetOpts
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> ByteString
-> JSONSetOpts
-> m (f (Maybe Status))
jsonSetOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> ByteString -> ByteString -> JSONSetOpts -> m (f (Maybe Status))
jsonSetOpts ByteString
key ByteString
path ByteString
value JSONSetOpts
opts =
[ByteString] -> m (f (Maybe Status))
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f (Maybe Status)))
-> [ByteString] -> m (f (Maybe Status))
forall a b. (a -> b) -> a -> b
$ [ByteString
"JSON.SET", ByteString
key, ByteString
path, ByteString
value] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ JSONSetOpts -> [ByteString]
jsonSetOptsToArgs JSONSetOpts
opts
jsonStrappend
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonStrappend :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonStrappend ByteString
key ByteString
value = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.STRAPPEND", ByteString
key, ByteString
value]
jsonStrappendAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> ByteString
-> m (f Reply)
jsonStrappendAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> ByteString -> m (f Reply)
jsonStrappendAt ByteString
key ByteString
path ByteString
value = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.STRAPPEND", ByteString
key, ByteString
path, ByteString
value]
jsonToggle
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonToggle :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonToggle ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.TOGGLE", ByteString
key, ByteString
path]
jsonType
:: (RedisCtx m f)
=> ByteString
-> m (f Reply)
jsonType :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
jsonType ByteString
key = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.TYPE", ByteString
key]
jsonTypeAt
:: (RedisCtx m f)
=> ByteString
-> ByteString
-> m (f Reply)
jsonTypeAt :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
jsonTypeAt ByteString
key ByteString
path = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"JSON.TYPE", ByteString
key, ByteString
path]