@@ -37,6 +37,15 @@ module Squeal.PostgreSQL.Expression.Array
3737 , unnest
3838 , arrAny
3939 , arrAll
40+ , arrayAppend
41+ , arrayPrepend
42+ , arrayCat
43+ , arrayPosition
44+ , arrayPositionBegins
45+ , arrayPositions
46+ , arrayRemoveNull
47+ , arrayReplace
48+ , trimArray
4049 ) where
4150
4251import Data.String
@@ -47,6 +56,7 @@ import qualified Generics.SOP as SOP
4756
4857import Squeal.PostgreSQL.Expression
4958import Squeal.PostgreSQL.Expression.Logic
59+ import Squeal.PostgreSQL.Expression.Null
5060import Squeal.PostgreSQL.Expression.Type
5161import Squeal.PostgreSQL.Query.From.Set
5262import Squeal.PostgreSQL.Render
@@ -240,3 +250,42 @@ arrAny
240250 -> Expression grp lat with db params from (null ('PGvararray ty2 )) -- ^ array
241251 -> Condition grp lat with db params from
242252arrAny x (?) xs = x ? (UnsafeExpression $ " ANY" <+> parenthesized (renderSQL xs))
253+
254+ arrayAppend :: '[null ('PGvararray ty ), ty ] ---> null ('PGvararray ty )
255+ arrayAppend = unsafeFunctionN " array_append"
256+
257+ arrayPrepend :: '[ty , null ('PGvararray ty )] ---> null ('PGvararray ty )
258+ arrayPrepend = unsafeFunctionN " array_prepend"
259+
260+ arrayCat
261+ :: '[null ('PGvararray ty ), null ('PGvararray ty )]
262+ ---> null ('PGvararray ty )
263+ arrayCat = unsafeFunctionN " array_cat"
264+
265+ arrayPosition :: '[null ('PGvararray ty ), ty ] ---> 'Null 'PGint8
266+ arrayPosition = unsafeFunctionN " array_position"
267+
268+ arrayPositionBegins
269+ :: '[null ('PGvararray ty ), ty , null 'PGint8] ---> 'Null 'PGint8
270+ arrayPositionBegins = unsafeFunctionN " array_position"
271+
272+ arrayPositions
273+ :: '[null ('PGvararray ty ), ty ]
274+ ---> null ('PGvararray ('NotNull 'PGint8))
275+ arrayPositions = unsafeFunctionN " array_positions"
276+
277+ arrayRemove :: '[null ('PGvararray ty ), ty ] ---> null ('PGvararray ty )
278+ arrayRemove = unsafeFunctionN " array_remove"
279+
280+ arrayRemoveNull :: null ('PGvararray ('Null ty )) --> null ('PGvararray ('NotNull ty ))
281+ arrayRemoveNull arr = UnsafeExpression (renderSQL (arrayRemove (arr *: null_)))
282+
283+ arrayReplace
284+ :: '[null ('PGvararray ty ), ty , ty ]
285+ ---> null ('PGvararray ty )
286+ arrayReplace = unsafeFunctionN " array_replace"
287+
288+ trimArray
289+ :: '[null ('PGvararray ty ), 'NotNull 'PGint8]
290+ ---> null ('PGvararray ty )
291+ trimArray = unsafeFunctionN " trim_array"
0 commit comments