@@ -114,6 +114,14 @@ module Squeal.PostgreSQL.Expression
114 , jsonbBuildArray
114 , jsonbBuildArray
115 , jsonBuildObject
115 , jsonBuildObject
116 , jsonbBuildObject
116 , jsonbBuildObject
123+ , jsonEachAsComposite
124+ , jsonbEachAsComposite
117 , jsonObjectKeys
125 , jsonObjectKeys
118 , jsonbObjectKeys
126 , jsonbObjectKeys
119 -- ** Aggregation
127 -- ** Aggregation
@@ -1158,11 +1166,87 @@ jsonbArrayLength
1158 -> Expression schema relations grouping params (nullity 'PGint4)
1166 -> Expression schema relations grouping params (nullity 'PGint4)
1159jsonbArrayLength = unsafeFunction "jsonb_array_length"
1167jsonbArrayLength = 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).
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)
1214+-- | Returns JSON value pointed to by path_elems (equivalent to #> operator).
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)
1223+-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
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)
1233+-- | Returns JSON value pointed to by path_elems (equivalent to #> operator),
1235+jsonbExtractPathText
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)
1243+-- | Returns set of keys in the outermost JSON object.
1161jsonObjectKeys
1244jsonObjectKeys
1162 :: Expression schema relations grouping params (nullity 'PGjson)
1245 :: Expression schema relations grouping params (nullity 'PGjson)
1163 -> Expression schema relations grouping params (nullity 'PGtext)
1246 -> Expression schema relations grouping params (nullity 'PGtext)
1164jsonObjectKeys = unsafeFunction "json_object_keys"
1247jsonObjectKeys = unsafeFunction "json_object_keys"
1249+-- | Returns set of keys in the outermost JSON object.
1166jsonbObjectKeys
1250jsonbObjectKeys
1167 :: Expression schema relations grouping params (nullity 'PGjsonb)
1251 :: Expression schema relations grouping params (nullity 'PGjsonb)
1168 -> Expression schema relations grouping params (nullity 'PGtext)
1252 -> Expression schema relations grouping params (nullity 'PGtext)