{-# LANGUAGE
DataKinds
, FlexibleContexts
, FlexibleInstances
, GADTs
, OverloadedLabels
, OverloadedStrings
, PolyKinds
, RankNTypes
, ScopedTypeVariables
, TypeApplications
, TypeOperators
, UndecidableInstances
, UndecidableSuperClasses
#-}
module Squeal.PostgreSQL.Expression.Json
(
(.->)
, (.->>)
, (.#>)
, (.#>>)
, (.?)
, (.?|)
, (.?&)
, (.-.)
, (#-.)
, toJson
, toJsonb
, arrayToJson
, rowToJson
, jsonBuildArray
, jsonbBuildArray
, JsonBuildObject (..)
, jsonObject
, jsonbObject
, jsonZipObject
, jsonbZipObject
, jsonArrayLength
, jsonbArrayLength
, jsonTypeof
, jsonbTypeof
, jsonStripNulls
, jsonbStripNulls
, jsonbSet
, jsonbInsert
, jsonbPretty
, jsonEach
, jsonbEach
, jsonEachText
, jsonArrayElementsText
, jsonbEachText
, jsonbArrayElementsText
, jsonObjectKeys
, jsonbObjectKeys
, JsonPopulateFunction
, jsonPopulateRecord
, jsonbPopulateRecord
, jsonPopulateRecordSet
, jsonbPopulateRecordSet
, JsonToRecordFunction
, jsonToRecord
, jsonbToRecord
, jsonToRecordSet
, jsonbToRecordSet
) where
import Data.ByteString (ByteString)
import GHC.TypeLits
import Squeal.PostgreSQL.Type.Alias
import Squeal.PostgreSQL.Expression
import Squeal.PostgreSQL.Expression.Type
import Squeal.PostgreSQL.Type.List
import Squeal.PostgreSQL.Query.From
import Squeal.PostgreSQL.Query.From.Set
import Squeal.PostgreSQL.Render
import Squeal.PostgreSQL.Type.Schema
import qualified Generics.SOP as SOP
(.->)
:: (json `In` PGJsonType, key `In` PGJsonKey)
=> Operator (null json) (null key) ('Null json)
infixl 8 .->
.-> :: forall (json :: PGType) (key :: PGType)
(null :: PGType -> NullType).
(In json PGJsonType, In key PGJsonKey) =>
Operator (null json) (null key) ('Null json)
(.->) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"->"
(.->>)
:: (json `In` PGJsonType, key `In` PGJsonKey)
=> Operator (null json) (null key) ('Null 'PGtext)
infixl 8 .->>
.->> :: forall (json :: PGType) (key :: PGType)
(null :: PGType -> NullType).
(In json PGJsonType, In key PGJsonKey) =>
Operator (null json) (null key) ('Null 'PGtext)
(.->>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"->>"
(.#>)
:: json `In` PGJsonType
=> Operator (null json) (null ('PGvararray ('NotNull 'PGtext))) ('Null json)
infixl 8 .#>
.#> :: forall (json :: PGType) (null :: PGType -> NullType).
In json PGJsonType =>
Operator
(null json) (null ('PGvararray ('NotNull 'PGtext))) ('Null json)
(.#>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"#>"
(.#>>)
:: json `In` PGJsonType
=> Operator (null json) (null ('PGvararray ('NotNull 'PGtext))) ('Null 'PGtext)
infixl 8 .#>>
.#>> :: forall (json :: PGType) (null :: PGType -> NullType).
In json PGJsonType =>
Operator
(null json) (null ('PGvararray ('NotNull 'PGtext))) ('Null 'PGtext)
(.#>>) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"#>>"
(.?) :: Operator (null 'PGjsonb) (null 'PGtext) ('Null 'PGbool)
infixl 9 .?
.? :: forall (null :: PGType -> NullType).
Operator (null 'PGjsonb) (null 'PGtext) ('Null 'PGbool)
(.?) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"?"
(.?|) :: Operator
(null 'PGjsonb)
(null ('PGvararray ('NotNull 'PGtext)))
('Null 'PGbool)
infixl 9 .?|
.?| :: forall (null :: PGType -> NullType).
Operator
(null 'PGjsonb)
(null ('PGvararray ('NotNull 'PGtext)))
('Null 'PGbool)
(.?|) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"?|"
(.?&) :: Operator
(null 'PGjsonb)
(null ('PGvararray ('NotNull 'PGtext)))
('Null 'PGbool)
infixl 9 .?&
.?& :: forall (null :: PGType -> NullType).
Operator
(null 'PGjsonb)
(null ('PGvararray ('NotNull 'PGtext)))
('Null 'PGbool)
(.?&) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"?&"
(.-.)
:: key `In` '[ 'PGtext, 'PGvararray ('NotNull 'PGtext), 'PGint4, 'PGint2 ]
=> Operator (null 'PGjsonb) (null key) (null 'PGjsonb)
infixl 6 .-.
.-. :: forall (key :: PGType) (null :: PGType -> NullType).
In
key
'[ 'PGtext, 'PGvararray ('NotNull 'PGtext), 'PGint4, 'PGint2] =>
Operator (null 'PGjsonb) (null key) (null 'PGjsonb)
(.-.) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"-"
(#-.) :: Operator (null 'PGjsonb) (null ('PGvararray ('NotNull 'PGtext))) (null 'PGjsonb)
infixl 6 #-.
#-. :: forall (null :: PGType -> NullType).
Operator
(null 'PGjsonb)
(null ('PGvararray ('NotNull 'PGtext)))
(null 'PGjsonb)
(#-.) = forall (ty0 :: NullType) (ty1 :: NullType) (ty2 :: NullType).
ByteString -> Operator ty0 ty1 ty2
unsafeBinaryOp ByteString
"#-"
toJson :: null ty --> null 'PGjson
toJson :: forall (null :: PGType -> NullType) (ty :: PGType).
null ty --> null 'PGjson
toJson = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"to_json"
toJsonb :: null ty --> null 'PGjsonb
toJsonb :: forall (null :: PGType -> NullType) (ty :: PGType).
null ty --> null 'PGjsonb
toJsonb = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"to_jsonb"
arrayToJson :: null ('PGvararray ty) --> null 'PGjson
arrayToJson :: forall (null :: PGType -> NullType) (ty :: NullType).
null ('PGvararray ty) --> null 'PGjson
arrayToJson = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"array_to_json"
rowToJson :: null ('PGcomposite ty) --> null 'PGjson
rowToJson :: forall (null :: PGType -> NullType) (ty :: RowType).
null ('PGcomposite ty) --> null 'PGjson
rowToJson = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"row_to_json"
jsonBuildArray :: SOP.SListI tuple => tuple ---> null 'PGjson
jsonBuildArray :: forall (tuple :: [NullType]) (null :: PGType -> NullType).
SListI tuple =>
tuple ---> null 'PGjson
jsonBuildArray = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"json_build_array"
jsonbBuildArray :: SOP.SListI tuple => tuple ---> null 'PGjsonb
jsonbBuildArray :: forall (tuple :: [NullType]) (null :: PGType -> NullType).
SListI tuple =>
tuple ---> null 'PGjsonb
jsonbBuildArray = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"jsonb_build_array"
class SOP.SListI tys => JsonBuildObject tys where
jsonBuildObject :: tys ---> null 'PGjson
jsonBuildObject = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"json_build_object"
jsonbBuildObject :: tys ---> null 'PGjsonb
jsonbBuildObject = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"jsonb_build_object"
instance JsonBuildObject '[]
instance (JsonBuildObject tys, key `In` PGJsonKey)
=> JsonBuildObject ('NotNull key ': value ': tys)
jsonObject
:: null ('PGfixarray '[n,2] ('NotNull 'PGtext))
--> null 'PGjson
jsonObject :: forall (null :: PGType -> NullType) (n :: Natural).
null ('PGfixarray '[n, 2] ('NotNull 'PGtext)) --> null 'PGjson
jsonObject = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"json_object"
jsonbObject
:: null ('PGfixarray '[n,2] ('NotNull 'PGtext))
--> null 'PGjsonb
jsonbObject :: forall (null :: PGType -> NullType) (n :: Natural).
null ('PGfixarray '[n, 2] ('NotNull 'PGtext)) --> null 'PGjsonb
jsonbObject = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"jsonb_object"
jsonZipObject ::
'[ null ('PGvararray ('NotNull 'PGtext))
, null ('PGvararray ('NotNull 'PGtext)) ]
---> null 'PGjson
jsonZipObject :: forall (null :: PGType -> NullType).
'[null ('PGvararray ('NotNull 'PGtext)),
null ('PGvararray ('NotNull 'PGtext))]
---> null 'PGjson
jsonZipObject = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"json_object"
jsonbZipObject ::
'[ null ('PGvararray ('NotNull 'PGtext))
, null ('PGvararray ('NotNull 'PGtext)) ]
---> null 'PGjsonb
jsonbZipObject :: forall (null :: PGType -> NullType).
'[null ('PGvararray ('NotNull 'PGtext)),
null ('PGvararray ('NotNull 'PGtext))]
---> null 'PGjsonb
jsonbZipObject = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"jsonb_object"
jsonArrayLength :: null 'PGjson --> null 'PGint4
jsonArrayLength :: forall (null :: PGType -> NullType). null 'PGjson --> null 'PGint4
jsonArrayLength = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"json_array_length"
jsonbArrayLength :: null 'PGjsonb --> null 'PGint4
jsonbArrayLength :: forall (null :: PGType -> NullType). null 'PGjsonb --> null 'PGint4
jsonbArrayLength = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"jsonb_array_length"
jsonTypeof :: null 'PGjson --> null 'PGtext
jsonTypeof :: forall (null :: PGType -> NullType). null 'PGjson --> null 'PGtext
jsonTypeof = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"json_typeof"
jsonbTypeof :: null 'PGjsonb --> null 'PGtext
jsonbTypeof :: forall (null :: PGType -> NullType). null 'PGjsonb --> null 'PGtext
jsonbTypeof = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"jsonb_typeof"
jsonStripNulls :: null 'PGjson --> null 'PGjson
jsonStripNulls :: forall (null :: PGType -> NullType). null 'PGjson --> null 'PGjson
jsonStripNulls = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"json_strip_nulls"
jsonbStripNulls :: null 'PGjsonb --> null 'PGjsonb
jsonbStripNulls :: forall (null :: PGType -> NullType).
null 'PGjsonb --> null 'PGjsonb
jsonbStripNulls = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"jsonb_strip_nulls"
jsonbSet ::
'[ null 'PGjsonb, null ('PGvararray ('NotNull 'PGtext))
, null 'PGjsonb, null 'PGbool ] ---> null 'PGjsonb
jsonbSet :: forall (null :: PGType -> NullType).
'[null 'PGjsonb, null ('PGvararray ('NotNull 'PGtext)),
null 'PGjsonb, null 'PGbool]
---> null 'PGjsonb
jsonbSet = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"jsonbSet"
jsonbInsert ::
'[ null 'PGjsonb, null ('PGvararray ('NotNull 'PGtext))
, null 'PGjsonb, null 'PGbool ] ---> null 'PGjsonb
jsonbInsert :: forall (null :: PGType -> NullType).
'[null 'PGjsonb, null ('PGvararray ('NotNull 'PGtext)),
null 'PGjsonb, null 'PGbool]
---> null 'PGjsonb
jsonbInsert = forall (xs :: [NullType]) (y :: NullType).
SListI xs =>
ByteString -> xs ---> y
unsafeFunctionN ByteString
"jsonb_insert"
jsonbPretty :: null 'PGjsonb --> null 'PGtext
jsonbPretty :: forall (null :: PGType -> NullType). null 'PGjsonb --> null 'PGtext
jsonbPretty = forall (x :: NullType) (y :: NullType). ByteString -> x --> y
unsafeFunction ByteString
"jsonb_pretty"
jsonEach :: null 'PGjson -|->
("json_each" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson])
jsonEach :: forall (null :: PGType -> NullType).
null 'PGjson
-|-> ("json_each"
::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson])
jsonEach = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"json_each"
jsonbEach
:: null 'PGjsonb -|->
("jsonb_each" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson])
jsonbEach :: forall (null :: PGType -> NullType).
null 'PGjsonb
-|-> ("jsonb_each"
::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson])
jsonbEach = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"jsonb_each"
jsonEachText
:: null 'PGjson -|->
("json_each_text" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext])
jsonEachText :: forall (null :: PGType -> NullType).
null 'PGjson
-|-> ("json_each_text"
::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext])
jsonEachText = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"json_each_text"
jsonArrayElementsText
:: null 'PGjson -|->
("json_array_elements_text" ::: '["value" ::: 'NotNull 'PGtext])
jsonArrayElementsText :: forall (null :: PGType -> NullType).
null 'PGjson
-|-> ("json_array_elements_text"
::: '["value" ::: 'NotNull 'PGtext])
jsonArrayElementsText = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"json_array_elements_text"
jsonbEachText
:: null 'PGjsonb -|->
("jsonb_each_text" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext])
jsonbEachText :: forall (null :: PGType -> NullType).
null 'PGjsonb
-|-> ("jsonb_each_text"
::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext])
jsonbEachText = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"jsonb_each_text"
jsonObjectKeys
:: null 'PGjson -|->
("json_object_keys" ::: '["json_object_keys" ::: 'NotNull 'PGtext])
jsonObjectKeys :: forall (null :: PGType -> NullType).
null 'PGjson
-|-> ("json_object_keys"
::: '["json_object_keys" ::: 'NotNull 'PGtext])
jsonObjectKeys = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"json_object_keys"
jsonbObjectKeys
:: null 'PGjsonb -|->
("jsonb_object_keys" ::: '["jsonb_object_keys" ::: 'NotNull 'PGtext])
jsonbObjectKeys :: forall (null :: PGType -> NullType).
null 'PGjsonb
-|-> ("jsonb_object_keys"
::: '["jsonb_object_keys" ::: 'NotNull 'PGtext])
jsonbObjectKeys = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"jsonb_object_keys"
jsonbArrayElementsText
:: null 'PGjsonb -|->
("jsonb_array_elements_text" ::: '["value" ::: 'NotNull 'PGtext])
jsonbArrayElementsText :: forall (null :: PGType -> NullType).
null 'PGjsonb
-|-> ("jsonb_array_elements_text"
::: '["value" ::: 'NotNull 'PGtext])
jsonbArrayElementsText = forall (fun :: Symbol) (ty :: NullType) (row :: RowType).
KnownSymbol fun =>
ByteString -> ty -|-> (fun ::: row)
unsafeSetFunction ByteString
"jsonb_array_elements_text"
type JsonPopulateFunction fun json
= forall db row lat with params
. json `In` PGJsonType
=> TypeExpression db ('NotNull ('PGcomposite row))
-> Expression 'Ungrouped lat with db params '[] ('NotNull json)
-> FromClause lat with db params '[fun ::: row]
unsafePopulateFunction
:: forall fun ty
. KnownSymbol fun => Alias fun -> JsonPopulateFunction fun ty
unsafePopulateFunction :: forall (fun :: Symbol) (ty :: PGType).
KnownSymbol fun =>
Alias fun -> JsonPopulateFunction fun ty
unsafePopulateFunction Alias fun
_fun TypeExpression db ('NotNull ('PGcomposite row))
ty Expression 'Ungrouped lat with db params '[] ('NotNull ty)
expr = forall (lat :: FromType) (with :: FromType) (db :: SchemasType)
(params :: [NullType]) (from :: FromType).
ByteString -> FromClause lat with db params from
UnsafeFromClause forall a b. (a -> b) -> a -> b
$ forall (s :: Symbol). KnownSymbol s => ByteString
renderSymbol @fun
forall a. Semigroup a => a -> a -> a
<> ByteString -> ByteString
parenthesized (ByteString
"null::" forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL TypeExpression db ('NotNull ('PGcomposite row))
ty forall a. Semigroup a => a -> a -> a
<> ByteString
", " forall a. Semigroup a => a -> a -> a
<> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression 'Ungrouped lat with db params '[] ('NotNull ty)
expr)
jsonPopulateRecord :: JsonPopulateFunction "json_populate_record" 'PGjson
jsonPopulateRecord :: JsonPopulateFunction "json_populate_record" 'PGjson
jsonPopulateRecord = forall (fun :: Symbol) (ty :: PGType).
KnownSymbol fun =>
Alias fun -> JsonPopulateFunction fun ty
unsafePopulateFunction forall a. IsLabel "json_populate_record" a => a
#json_populate_record
jsonbPopulateRecord :: JsonPopulateFunction "jsonb_populate_record" 'PGjsonb
jsonbPopulateRecord :: JsonPopulateFunction "jsonb_populate_record" 'PGjsonb
jsonbPopulateRecord = forall (fun :: Symbol) (ty :: PGType).
KnownSymbol fun =>
Alias fun -> JsonPopulateFunction fun ty
unsafePopulateFunction forall a. IsLabel "jsonb_populate_record" a => a
#jsonb_populate_record
jsonPopulateRecordSet :: JsonPopulateFunction "json_populate_record_set" 'PGjson
jsonPopulateRecordSet :: JsonPopulateFunction "json_populate_record_set" 'PGjson
jsonPopulateRecordSet = forall (fun :: Symbol) (ty :: PGType).
KnownSymbol fun =>
Alias fun -> JsonPopulateFunction fun ty
unsafePopulateFunction forall a. IsLabel "json_populate_record_set" a => a
#json_populate_record_set
jsonbPopulateRecordSet :: JsonPopulateFunction "jsonb_populate_record_set" 'PGjsonb
jsonbPopulateRecordSet :: JsonPopulateFunction "jsonb_populate_record_set" 'PGjsonb
jsonbPopulateRecordSet = forall (fun :: Symbol) (ty :: PGType).
KnownSymbol fun =>
Alias fun -> JsonPopulateFunction fun ty
unsafePopulateFunction forall a. IsLabel "jsonb_populate_record_set" a => a
#jsonb_populate_record_set
type JsonToRecordFunction json
= forall lat with db params tab row
. (SOP.SListI row, json `In` PGJsonType)
=> Expression 'Ungrouped lat with db params '[] ('NotNull json)
-> Aliased (NP (Aliased (TypeExpression db))) (tab ::: row)
-> FromClause lat with db params '[tab ::: row]
unsafeRecordFunction :: ByteString -> JsonToRecordFunction json
unsafeRecordFunction :: forall (json :: PGType). ByteString -> JsonToRecordFunction json
unsafeRecordFunction ByteString
fun Expression 'Ungrouped lat with db params '[] ('NotNull json)
expr (NP (Aliased (TypeExpression db)) ty
types `As` Alias alias
tab) = forall (lat :: FromType) (with :: FromType) (db :: SchemasType)
(params :: [NullType]) (from :: FromType).
ByteString -> FromClause lat with db params from
UnsafeFromClause forall a b. (a -> b) -> a -> b
$
ByteString
fun forall a. Semigroup a => a -> a -> a
<> ByteString -> ByteString
parenthesized (forall sql. RenderSQL sql => sql -> ByteString
renderSQL Expression 'Ungrouped lat with db params '[] ('NotNull json)
expr) ByteString -> ByteString -> ByteString
<+> ByteString
"AS" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias alias
tab
forall a. Semigroup a => a -> a -> a
<> ByteString -> ByteString
parenthesized (forall {k} (xs :: [k]) (expression :: k -> *).
SListI xs =>
(forall (x :: k). expression x -> ByteString)
-> NP expression xs -> ByteString
renderCommaSeparated forall (db :: SchemasType) (ty :: (Symbol, NullType)).
Aliased (TypeExpression db) ty -> ByteString
renderTy NP (Aliased (TypeExpression db)) ty
types)
where
renderTy :: Aliased (TypeExpression db) ty -> ByteString
renderTy :: forall (db :: SchemasType) (ty :: (Symbol, NullType)).
Aliased (TypeExpression db) ty -> ByteString
renderTy (TypeExpression db ty
ty `As` Alias alias
alias) = forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias alias
alias ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL TypeExpression db ty
ty
jsonToRecord :: JsonToRecordFunction 'PGjson
jsonToRecord :: JsonToRecordFunction 'PGjson
jsonToRecord = forall (json :: PGType). ByteString -> JsonToRecordFunction json
unsafeRecordFunction ByteString
"json_to_record"
jsonbToRecord :: JsonToRecordFunction 'PGjsonb
jsonbToRecord :: JsonToRecordFunction 'PGjsonb
jsonbToRecord = forall (json :: PGType). ByteString -> JsonToRecordFunction json
unsafeRecordFunction ByteString
"jsonb_to_record"
jsonToRecordSet :: JsonToRecordFunction 'PGjson
jsonToRecordSet :: JsonToRecordFunction 'PGjson
jsonToRecordSet = forall (json :: PGType). ByteString -> JsonToRecordFunction json
unsafeRecordFunction ByteString
"json_to_record_set"
jsonbToRecordSet :: JsonToRecordFunction 'PGjsonb
jsonbToRecordSet :: JsonToRecordFunction 'PGjsonb
jsonbToRecordSet = forall (json :: PGType). ByteString -> JsonToRecordFunction json
unsafeRecordFunction ByteString
"jsonb_to_record_set"