@@ -45,6 +45,7 @@ module Squeal.PostgreSQL.Expression
46 -- ** Collections
46 -- ** Collections
50 -- ** Functions
51 -- ** Functions
@@ -195,6 +196,7 @@ import Data.Semigroup hiding (All)
195import qualified Data.Aeson as JSON
196import qualified Data.Aeson as JSON
196import Data.Ratio
197import Data.Ratio
197import Data.String
198import Data.String
198import Generics.SOP hiding (from)
200import Generics.SOP hiding (from)
199import GHC.OverloadedLabels
201import GHC.OverloadedLabels
200import GHC.TypeLits
202import GHC.TypeLits
@@ -444,6 +446,13 @@ array
444array xs = UnsafeExpression $
446array xs = UnsafeExpression $
445 "ARRAY[" <> commaSeparated (renderExpression <$> xs) <> "]"
447 "ARRAY[" <> commaSeparated (renderExpression <$> xs) <> "]"
451+ -> Expression schema from grouping params (nullity ('PGvararray ty))
452+ -> Expression schema from grouping params (NullifyType ty)
453+index n expr = UnsafeExpression $
454+ parenthesized (renderExpression expr) <> "[" <> fromString (show n) <> "]"
447instance (KnownSymbol label, label `In` labels) => IsPGlabel label
456instance (KnownSymbol label, label `In` labels) => IsPGlabel label
448 (Expression schema from grouping params (nullity ('PGenum labels))) where
457 (Expression schema from grouping params (nullity ('PGenum labels))) where
449 label = UnsafeExpression $ renderLabel (PGlabel @label)
458 label = UnsafeExpression $ renderLabel (PGlabel @label)