module Database.Beam.Postgres.PgCrypto
( PgCrypto(..) ) where
import Database.Beam
import Database.Beam.Backend.SQL
import Database.Beam.Postgres.Extensions
import Database.Beam.Postgres.Extensions.Internal
import Data.Int
import Data.Text (Text)
import Data.ByteString (ByteString)
import Data.Vector (Vector)
import Data.UUID.Types (UUID)
data PgCrypto
= PgCrypto
{ PgCrypto
-> forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString)
pgCryptoDigestText ::
forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString)
, PgCrypto
-> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> ByteString)
pgCryptoDigestBytes ::
forall ctxt s. LiftPg ctxt s (ByteString -> Text -> ByteString)
, PgCrypto
-> forall ctxt s.
LiftPg ctxt s (Text -> Text -> Text -> ByteString)
pgCryptoHmacText ::
forall ctxt s. LiftPg ctxt s (Text -> Text -> Text -> ByteString)
, PgCrypto
-> forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)
pgCryptoHmacBytes ::
forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)
, PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> Text)
pgCryptoCrypt ::
forall ctxt s. LiftPg ctxt s (Text -> Text -> Text)
, PgCrypto
-> forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text)
pgCryptoGenSalt ::
forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text)
, PgCrypto
-> forall ctxt s.
LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)
pgCryptoPgpSymEncrypt ::
forall ctxt s. LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)
, PgCrypto
-> forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
pgCryptoPgpSymEncryptBytea ::
forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
, PgCrypto
-> forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)
pgCryptoPgpSymDecrypt ::
forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)
, PgCrypto
-> forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
pgCryptoPgpSymDecryptBytea ::
forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
, PgCrypto
-> forall ctxt s.
LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)
pgCryptoPgpPubEncrypt ::
forall ctxt s. LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)
, PgCrypto
-> forall ctxt s.
LiftPg
ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)
pgCryptoPgpPubEncryptBytea ::
forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)
, PgCrypto
-> forall ctxt s.
LiftPg
ctxt
s
(ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)
pgCryptoPgpPubDecrypt ::
forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)
, PgCrypto
-> forall ctxt s.
LiftPg
ctxt
s
(ByteString
-> ByteString -> Maybe Text -> Maybe Text -> ByteString)
pgCryptoPgpPubDecryptBytea ::
forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> ByteString)
, PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text)
pgCryptoPgpKeyId ::
forall ctxt s. LiftPg ctxt s (ByteString -> Text)
, PgCrypto
-> forall ctxt s.
PgExpr ctxt s ByteString
-> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text))
-> PgExpr ctxt s Text
pgCryptoArmor ::
forall ctxt s. PgExpr ctxt s ByteString ->
Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text)) ->
PgExpr ctxt s Text
, PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> ByteString)
pgCryptoDearmor ::
forall ctxt s. LiftPg ctxt s (Text -> ByteString)
, PgCrypto
-> forall ctxt s i.
Integral i =>
PgExpr ctxt s i -> PgExpr ctxt s ByteString
pgCryptoGenRandomBytes ::
forall ctxt s i. Integral i => PgExpr ctxt s i -> PgExpr ctxt s ByteString
, PgCrypto -> forall ctxt s. PgExpr ctxt s UUID
pgCryptoGenRandomUUID ::
forall ctxt s. PgExpr ctxt s UUID
}
instance IsPgExtension PgCrypto where
pgExtensionName :: Proxy PgCrypto -> Text
pgExtensionName Proxy PgCrypto
_ = Text
"pgcrypto"
pgExtensionBuild :: PgCrypto
pgExtensionBuild = PgCrypto :: (forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString))
-> (forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> ByteString))
-> (forall ctxt s.
LiftPg ctxt s (Text -> Text -> Text -> ByteString))
-> (forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Text -> ByteString))
-> (forall ctxt s. LiftPg ctxt s (Text -> Text -> Text))
-> (forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text))
-> (forall ctxt s.
LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString))
-> (forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString))
-> (forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text))
-> (forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString))
-> (forall ctxt s.
LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString))
-> (forall ctxt s.
LiftPg
ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString))
-> (forall ctxt s.
LiftPg
ctxt
s
(ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text))
-> (forall ctxt s.
LiftPg
ctxt
s
(ByteString
-> ByteString -> Maybe Text -> Maybe Text -> ByteString))
-> (forall ctxt s. LiftPg ctxt s (ByteString -> Text))
-> (forall ctxt s.
PgExpr ctxt s ByteString
-> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text))
-> PgExpr ctxt s Text)
-> (forall ctxt s. LiftPg ctxt s (Text -> ByteString))
-> (forall ctxt s i.
Integral i =>
PgExpr ctxt s i -> PgExpr ctxt s ByteString)
-> (forall ctxt s. PgExpr ctxt s UUID)
-> PgCrypto
PgCrypto {
pgCryptoDigestText :: forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString)
pgCryptoDigestText =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
type_) -> (Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"digest" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
type_]),
pgCryptoDigestBytes :: forall ctxt s. LiftPg ctxt s (ByteString -> Text -> ByteString)
pgCryptoDigestBytes =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
type_) -> (Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"digest" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
type_]),
pgCryptoHmacText :: forall ctxt s. LiftPg ctxt s (Text -> Text -> Text -> ByteString)
pgCryptoHmacText =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
key) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
type_) -> (Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"hmac" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
key, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
type_]),
pgCryptoHmacBytes :: forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)
pgCryptoHmacBytes =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
key) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
type_) -> (Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"hmac" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
key, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
type_]),
pgCryptoCrypt :: forall ctxt s. LiftPg ctxt s (Text -> Text -> Text)
pgCryptoCrypt =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
salt) ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s Text
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"crypt" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
salt]),
pgCryptoGenSalt :: forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text)
pgCryptoGenSalt =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
text) Maybe (QGenExpr ctxt Postgres s Int32)
iterCount ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s Text
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"gen_salt" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
text] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++ [Text -> PgExpressionSyntax]
-> (QGenExpr ctxt Postgres s Int32 -> [Text -> PgExpressionSyntax])
-> Maybe (QGenExpr ctxt Postgres s Int32)
-> [Text -> PgExpressionSyntax]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
iterCount') -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
iterCount']) Maybe (QGenExpr ctxt Postgres s Int32)
iterCount)),
pgCryptoPgpSymEncrypt :: forall ctxt s.
LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)
pgCryptoPgpSymEncrypt =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw) Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_sym_encrypt" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++ [Text -> PgExpressionSyntax]
-> (QGenExpr ctxt Postgres s Text -> [Text -> PgExpressionSyntax])
-> Maybe (QGenExpr ctxt Postgres s Text)
-> [Text -> PgExpressionSyntax]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options') -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options']) Maybe (QGenExpr ctxt Postgres s Text)
options)),
pgCryptoPgpSymEncryptBytea :: forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
pgCryptoPgpSymEncryptBytea =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw) Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_sym_encrypt_bytea" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++ [Text -> PgExpressionSyntax]
-> (QGenExpr ctxt Postgres s Text -> [Text -> PgExpressionSyntax])
-> Maybe (QGenExpr ctxt Postgres s Text)
-> [Text -> PgExpressionSyntax]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options') -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options']) Maybe (QGenExpr ctxt Postgres s Text)
options)),
pgCryptoPgpSymDecrypt :: forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)
pgCryptoPgpSymDecrypt =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw) Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s Text
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr
(Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_sym_decrypt" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++ [Text -> PgExpressionSyntax]
-> (QGenExpr ctxt Postgres s Text -> [Text -> PgExpressionSyntax])
-> Maybe (QGenExpr ctxt Postgres s Text)
-> [Text -> PgExpressionSyntax]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options') -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options']) Maybe (QGenExpr ctxt Postgres s Text)
options)),
pgCryptoPgpSymDecryptBytea :: forall ctxt s.
LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
pgCryptoPgpSymDecryptBytea =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw) Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr
(Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_sym_decrypt_bytea" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++ [Text -> PgExpressionSyntax]
-> (QGenExpr ctxt Postgres s Text -> [Text -> PgExpressionSyntax])
-> Maybe (QGenExpr ctxt Postgres s Text)
-> [Text -> PgExpressionSyntax]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options') -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options']) Maybe (QGenExpr ctxt Postgres s Text)
options)),
pgCryptoPgpPubEncrypt :: forall ctxt s.
LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)
pgCryptoPgpPubEncrypt =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
key) Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr
(Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_pub_encrypt" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
key] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++ [Text -> PgExpressionSyntax]
-> (QGenExpr ctxt Postgres s Text -> [Text -> PgExpressionSyntax])
-> Maybe (QGenExpr ctxt Postgres s Text)
-> [Text -> PgExpressionSyntax]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options') -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options']) Maybe (QGenExpr ctxt Postgres s Text)
options)),
pgCryptoPgpPubEncryptBytea :: forall ctxt s.
LiftPg
ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)
pgCryptoPgpPubEncryptBytea =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
key) Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr
(Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_pub_encrypt_bytea" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
key] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++ [Text -> PgExpressionSyntax]
-> (QGenExpr ctxt Postgres s Text -> [Text -> PgExpressionSyntax])
-> Maybe (QGenExpr ctxt Postgres s Text)
-> [Text -> PgExpressionSyntax]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options') -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options']) Maybe (QGenExpr ctxt Postgres s Text)
options)),
pgCryptoPgpPubDecrypt :: forall ctxt s.
LiftPg
ctxt
s
(ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)
pgCryptoPgpPubDecrypt =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
msg) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
key) Maybe (QGenExpr ctxt Postgres s Text)
pw Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s Text
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr
(Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_pub_decrypt" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
[Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA
( [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
msg, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
key] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++
case (Maybe (QGenExpr ctxt Postgres s Text)
pw, Maybe (QGenExpr ctxt Postgres s Text)
options) of
(Maybe (QGenExpr ctxt Postgres s Text)
Nothing, Maybe (QGenExpr ctxt Postgres s Text)
Nothing) -> []
(Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw'), Maybe (QGenExpr ctxt Postgres s Text)
Nothing) -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw']
(Maybe (QGenExpr ctxt Postgres s Text)
Nothing, Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options')) -> [ \Text
_ -> Sql92ExpressionValueSyntax PgExpressionSyntax -> PgExpressionSyntax
forall expr.
IsSql92ExpressionSyntax expr =>
Sql92ExpressionValueSyntax expr -> expr
valueE (String -> PgValueSyntax
forall expr ty. HasSqlValueSyntax expr ty => ty -> expr
sqlValueSyntax (String
"" :: String))
, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options' ]
(Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw'), Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options')) -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw', Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options'] )),
pgCryptoPgpPubDecryptBytea :: forall ctxt s.
LiftPg
ctxt
s
(ByteString
-> ByteString -> Maybe Text -> Maybe Text -> ByteString)
pgCryptoPgpPubDecryptBytea =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
msg) (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
key) Maybe (QGenExpr ctxt Postgres s Text)
pw Maybe (QGenExpr ctxt Postgres s Text)
options ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString)
-> (Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall a b. (a -> b) -> a -> b
$
(Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_pub_decrypt_bytea" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
[Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA
( [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
msg, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
key] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++
case (Maybe (QGenExpr ctxt Postgres s Text)
pw, Maybe (QGenExpr ctxt Postgres s Text)
options) of
(Maybe (QGenExpr ctxt Postgres s Text)
Nothing, Maybe (QGenExpr ctxt Postgres s Text)
Nothing) -> []
(Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw'), Maybe (QGenExpr ctxt Postgres s Text)
Nothing) -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw']
(Maybe (QGenExpr ctxt Postgres s Text)
Nothing, Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options')) -> [ \Text
_ -> Sql92ExpressionValueSyntax PgExpressionSyntax -> PgExpressionSyntax
forall expr.
IsSql92ExpressionSyntax expr =>
Sql92ExpressionValueSyntax expr -> expr
valueE (String -> PgValueSyntax
forall expr ty. HasSqlValueSyntax expr ty => ty -> expr
sqlValueSyntax (String
"" :: String))
, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options' ]
(Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
pw'), Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
options')) -> [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
pw', Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
options'] )),
pgCryptoPgpKeyId :: forall ctxt s. LiftPg ctxt s (ByteString -> Text)
pgCryptoPgpKeyId =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) -> (Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s Text
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"pgp_key_id" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_]),
pgCryptoArmor :: forall ctxt s.
PgExpr ctxt s ByteString
-> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text))
-> PgExpr ctxt s Text
pgCryptoArmor =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text))
keysData ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> PgExpr ctxt s Text
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"armor" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA
([Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_] [Text -> PgExpressionSyntax]
-> [Text -> PgExpressionSyntax] -> [Text -> PgExpressionSyntax]
forall a. [a] -> [a] -> [a]
++
case Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text))
keysData of
Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text))
Nothing -> []
Just (QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
keys, QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
values) ->
[Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
keys, Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
values])),
pgCryptoDearmor :: forall ctxt s. LiftPg ctxt s (Text -> ByteString)
pgCryptoDearmor =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
data_) -> (Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"dearmor" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
data_]),
pgCryptoGenRandomBytes :: forall ctxt s i.
Integral i =>
PgExpr ctxt s i -> PgExpr ctxt s ByteString
pgCryptoGenRandomBytes =
\(QExpr Text -> BeamSqlBackendExpressionSyntax Postgres
count) ->
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> PgExpr ctxt s ByteString
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"gen_random_bytes" ([PgExpressionSyntax] -> PgExpressionSyntax)
-> (Text -> [PgExpressionSyntax]) -> Text -> PgExpressionSyntax
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Text -> PgExpressionSyntax] -> Text -> [PgExpressionSyntax]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA [Text -> BeamSqlBackendExpressionSyntax Postgres
Text -> PgExpressionSyntax
count]),
pgCryptoGenRandomUUID :: forall ctxt s. PgExpr ctxt s UUID
pgCryptoGenRandomUUID =
(Text -> BeamSqlBackendExpressionSyntax Postgres)
-> QGenExpr ctxt Postgres s UUID
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (\Text
_ -> Text -> [PgExpressionSyntax] -> PgExpressionSyntax
forall expr. IsSql99ExpressionSyntax expr => Text -> [expr] -> expr
funcE Text
"gen_random_uuid" [])
}