@@ -114,6 +114,14 @@ module Squeal.PostgreSQL.Expression
114114 , jsonbBuildArray
115115 , jsonBuildObject
116116 , jsonbBuildObject
117+ , jsonObject
118+ , jsonbObject
119+ , jsonZipObject
120+ , jsonbZipObject
121+ , jsonArrayLength
122+ , jsonbArrayLength
123+ , jsonEachAsComposite
124+ , jsonbEachAsComposite
117125 , jsonObjectKeys
118126 , jsonbObjectKeys
119127 -- ** Aggregation
@@ -1158,11 +1166,87 @@ jsonbArrayLength
11581166 -> Expression schema relations grouping params (nullity 'PGint4)
11591167jsonbArrayLength = unsafeFunction "jsonb_array_length"
11601168
1169+-- | Expands the outermost JSON object into a set of key/value pairs.
1170+--
1171+-- See also 'Squeal.PostgreSQL.Query.jsonEach'.
1172+jsonEachAsComposite
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"
1177+
1178+-- | Expands the outermost JSON object into a set of key/value pairs.
1179+--
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"
1186+
1187+-- | Expands the outermost JSON object into a set of key/value pairs.
1188+--
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"
1195+
1196+-- | Expands the outermost JSON object into a set of key/value pairs.
1197+--
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"
1204+
1205+-- | Returns JSON value pointed to by path_elems (equivalent to #> operator).
1206+jsonExtractPath
1207+ :: SListI elems
1208+ => Expression schema relations grouping params (nullity 'PGjson)
1209+ -> NP (Expression schema relations grouping params) elems
1210+ -> Expression schema relations grouping params (nullity 'PGjsonb)
1211+jsonExtractPath x xs =
1212+ unsafeVariadicFunction "json_extract_path" (x :* xs)
1213+
1214+-- | Returns JSON value pointed to by path_elems (equivalent to #> operator).
1215+jsonbExtractPath
1216+ :: SListI elems
1217+ => Expression schema relations grouping params (nullity 'PGjsonb)
1218+ -> NP (Expression schema relations grouping params) elems
1219+ -> Expression schema relations grouping params (nullity 'PGjsonb)
1220+jsonbExtractPath x xs =
1221+ unsafeVariadicFunction "jsonb_extract_path" (x :* xs)
1222+
1223+-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
1224+-- as text.
1225+jsonExtractPathText
1226+ :: SListI elems
1227+ => Expression schema relations grouping params (nullity 'PGjson)
1228+ -> NP (Expression schema relations grouping params) elems
1229+ -> Expression schema relations grouping params (nullity 'PGjsonb)
1230+jsonExtractPathText x xs =
1231+ unsafeVariadicFunction "json_extract_path_text" (x :* xs)
1232+
1233+-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
1234+-- as text.
1235+jsonbExtractPathText
1236+ :: SListI elems
1237+ => Expression schema relations grouping params (nullity 'PGjsonb)
1238+ -> NP (Expression schema relations grouping params) elems
1239+ -> Expression schema relations grouping params (nullity 'PGjsonb)
1240+jsonbExtractPathText x xs =
1241+ unsafeVariadicFunction "jsonb_extract_path_text" (x :* xs)
1242+
1243+-- | Returns set of keys in the outermost JSON object.
11611244jsonObjectKeys
11621245 :: Expression schema relations grouping params (nullity 'PGjson)
11631246 -> Expression schema relations grouping params (nullity 'PGtext)
11641247jsonObjectKeys = unsafeFunction "json_object_keys"
11651248
1249+-- | Returns set of keys in the outermost JSON object.
11661250jsonbObjectKeys
11671251 :: Expression schema relations grouping params (nullity 'PGjsonb)
11681252 -> Expression schema relations grouping params (nullity 'PGtext)