@@ -120,10 +120,14 @@ module Squeal.PostgreSQL.Expression
120 , jsonbZipObject
120 , jsonbZipObject
121 , jsonArrayLength
121 , jsonArrayLength
122 , jsonbArrayLength
122 , jsonbArrayLength
123− , jsonEachAsComposite
123+ , jsonExtractPath
124− , jsonbEachAsComposite
124+ , jsonbExtractPath
125+ , jsonExtractPathAsText
126+ , jsonbExtractPathAsText
125 , jsonObjectKeys
127 , jsonObjectKeys
126 , jsonbObjectKeys
128 , jsonbObjectKeys
127 -- ** Aggregation
131 -- ** Aggregation
128 , unsafeAggregate, unsafeAggregateDistinct
132 , unsafeAggregate, unsafeAggregateDistinct
129 , sum_, sumDistinct
133 , sum_, sumDistinct
@@ -181,7 +185,6 @@ import Data.Semigroup
181import Data.Ratio
185import Data.Ratio
182import Data.String
186import Data.String
183import Generics.SOP hiding (from)
187import Generics.SOP hiding (from)
184−import GHC.Exts (Constraint)
185import GHC.OverloadedLabels
188import GHC.OverloadedLabels
186import GHC.TypeLits
189import GHC.TypeLits
187import Prelude hiding (id, (.))
190import Prelude hiding (id, (.))
@@ -1166,42 +1169,6 @@ jsonbArrayLength
1166 -> Expression schema relations grouping params (nullity 'PGint4)
1169 -> Expression schema relations grouping params (nullity 'PGint4)
1167jsonbArrayLength = unsafeFunction "jsonb_array_length"
1170jsonbArrayLength = unsafeFunction "jsonb_array_length"
1169−-- | Expands the outermost JSON object into a set of key/value pairs.
1171−-- See also 'Squeal.PostgreSQL.Query.jsonEach'.
1173− :: Expression schema relations grouping params (nullity 'PGjson)
1174− -> Expression schema relations grouping params
1175− (nullity ('PGcomposite '[ "key" ::: 'PGtext, "value" ::: 'PGjson ]))
1176−jsonEachAsComposite = unsafeFunction "json_each"
1178−-- | Expands the outermost JSON object into a set of key/value pairs.
1180−-- See also 'Squeal.PostgreSQL.Query.jsonbEach'
1181−jsonbEachAsComposite
1182− :: Expression schema relations grouping params (nullity 'PGjsonb)
1183− -> Expression schema relations grouping params
1184− (nullity ('PGcomposite '[ "key" ::: 'PGtext, "value" ::: 'PGjsonb ]))
1185−jsonbEachAsComposite = unsafeFunction "jsonb_each"
1187−-- | Expands the outermost JSON object into a set of key/value pairs.
1189−-- See also 'Squeal.PostgreSQL.Query.jsonEachText'.
1190−jsonEachTextAsComposite
1191− :: Expression schema relations grouping params (nullity 'PGjson)
1192− -> Expression schema relations grouping params
1193− (nullity ('PGcomposite '[ "key" ::: 'PGtext, "value" ::: 'PGtext ]))
1194−jsonEachTextAsComposite = unsafeFunction "json_each_text"
1196−-- | Expands the outermost JSON object into a set of key/value pairs.
1198−-- See also 'Squeal.PostgreSQL.Query.jsonbEachText'
1199−jsonbEachTextAsComposite
1200− :: Expression schema relations grouping params (nullity 'PGjsonb)
1201− -> Expression schema relations grouping params
1202− (nullity ('PGcomposite '[ "key" ::: 'PGtext, "value" ::: 'PGtext ]))
1203−jsonbEachTextAsComposite = unsafeFunction "jsonb_each_text"
1205-- | Returns JSON value pointed to by path_elems (equivalent to #> operator).
1172-- | Returns JSON value pointed to by path_elems (equivalent to #> operator).
1206jsonExtractPath
1173jsonExtractPath
1207 :: SListI elems
1174 :: SListI elems
@@ -1222,22 +1189,22 @@ jsonbExtractPath x xs =
1223-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
1190-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
1224-- as text.
1191-- as text.
1225−jsonExtractPathText
1192+jsonExtractPathAsText
1226 :: SListI elems
1193 :: SListI elems
1227 => Expression schema relations grouping params (nullity 'PGjson)
1194 => Expression schema relations grouping params (nullity 'PGjson)
1228 -> NP (Expression schema relations grouping params) elems
1195 -> NP (Expression schema relations grouping params) elems
1229 -> Expression schema relations grouping params (nullity 'PGjsonb)
1196 -> Expression schema relations grouping params (nullity 'PGjsonb)
1230−jsonExtractPathText x xs =
1197+jsonExtractPathAsText x xs =
1231 unsafeVariadicFunction "json_extract_path_text" (x :* xs)
1198 unsafeVariadicFunction "json_extract_path_text" (x :* xs)
1233-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
1200-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
1234-- as text.
1201-- as text.
1235−jsonbExtractPathText
1202+jsonbExtractPathAsText
1236 :: SListI elems
1203 :: SListI elems
1237 => Expression schema relations grouping params (nullity 'PGjsonb)
1204 => Expression schema relations grouping params (nullity 'PGjsonb)
1238 -> NP (Expression schema relations grouping params) elems
1205 -> NP (Expression schema relations grouping params) elems
1239 -> Expression schema relations grouping params (nullity 'PGjsonb)
1206 -> Expression schema relations grouping params (nullity 'PGjsonb)
1240−jsonbExtractPathText x xs =
1207+jsonbExtractPathAsText x xs =
1241 unsafeVariadicFunction "jsonb_extract_path_text" (x :* xs)
1208 unsafeVariadicFunction "jsonb_extract_path_text" (x :* xs)
1243-- | Returns set of keys in the outermost JSON object.
1210-- | Returns set of keys in the outermost JSON object.
@@ -1252,6 +1219,20 @@ jsonbObjectKeys
1252 -> Expression schema relations grouping params (nullity 'PGtext)
1219 -> Expression schema relations grouping params (nullity 'PGtext)
1253jsonbObjectKeys = unsafeFunction "jsonb_object_keys"
1220jsonbObjectKeys = unsafeFunction "jsonb_object_keys"
1222+-- | Returns the type of the outermost JSON value as a text string. Possible
1223+-- types are object, array, string, number, boolean, and null.
1225+ :: Expression schema relations grouping params (nullity 'PGjson)
1226+ -> Expression schema relations grouping params (nullity 'PGtext)
1227+jsonTypeof = unsafeFunction "json_typeof"
1229+-- | Returns the type of the outermost binary JSON value as a text string.
1230+-- Possible types are object, array, string, number, boolean, and null.
1232+ :: Expression schema relations grouping params (nullity 'PGjsonb)
1233+ -> Expression schema relations grouping params (nullity 'PGtext)
1234+jsonbTypeof = unsafeFunction "jsonb_typeof"
1255{-----------------------------------------
1236{-----------------------------------------
1256aggregation
1237aggregation
1257-----------------------------------------}
1238-----------------------------------------}