on dev help sign in
arrayN ~> fixarray
f9b7581Eitan Chatav
squeal-postgresql/exe/Example.hs+1−1
@@ -46,7 +46,7 @@ setup =
46 createTable #users
46 createTable #users
47 ( serial `As` #id :*
47 ( serial `As` #id :*
48 (text & notNull) `As` #name :*
48 (text & notNull) `As` #name :*
49− (array int2 & notNull) `As` #vec :* Nil )
49+ (vararray int2 & notNull) `As` #vec :* Nil )
50 ( primaryKey (Column #id :* Nil) `As` #pk_users :* Nil )
50 ( primaryKey (Column #id :* Nil) `As` #pk_users :* Nil )
51 >>>
51 >>>
52 createTable #emails
52 createTable #emails
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+4−4
@@ -138,7 +138,7 @@ module Squeal.PostgreSQL.Expression
138 , json
138 , json
139 , jsonb
139 , jsonb
140 , vararray
140 , vararray
141− , arrayN
141+ , fixarray
142 , notNull
142 , notNull
143 , default_
143 , default_
144 -- * Re-export
144 -- * Re-export
@@ -1164,12 +1164,12 @@ vararray
1164 -> TypeExpression ('NoDef :=> 'Null ('PGarray pg))
1164 -> TypeExpression ('NoDef :=> 'Null ('PGarray pg))
1165vararray ty = UnsafeTypeExpression $ renderTypeExpression ty <> "[]"
1165vararray ty = UnsafeTypeExpression $ renderTypeExpression ty <> "[]"
1166-- | fixed length array
1166-- | fixed length array
1167−arrayN
1167+fixarray
1168 :: KnownNat n
1168 :: KnownNat n
1169 => proxy n
1169 => proxy n
1170 -> TypeExpression ('NoDef :=> 'Null pg)
1170 -> TypeExpression ('NoDef :=> 'Null pg)
1171 -> TypeExpression ('NoDef :=> 'Null ('PGarrayN n pg))
1171 -> TypeExpression ('NoDef :=> 'Null ('PGarrayN n pg))
1172−arrayN p ty = UnsafeTypeExpression $
1172+fixarray p ty = UnsafeTypeExpression $
1173 renderTypeExpression ty <> "[" <> renderNat p <> "]"
1173 renderTypeExpression ty <> "[" <> renderNat p <> "]"
1174
1174
1175-- | used in `createTable` commands as a column constraint to ensure
1175-- | used in `createTable` commands as a column constraint to ensure
@@ -1215,4 +1215,4 @@ instance PGTyped 'PGjsonb where pgtype = jsonb
1215instance PGTyped ty => PGTyped ('PGarray ty) where
1215instance PGTyped ty => PGTyped ('PGarray ty) where
1216 pgtype = vararray (pgtype @ty)
1216 pgtype = vararray (pgtype @ty)
1217instance (KnownNat n, PGTyped ty) => PGTyped ('PGarrayN n ty) where
1217instance (KnownNat n, PGTyped ty) => PGTyped ('PGarrayN n ty) where
1218− pgtype = arrayN (Proxy @n) (pgtype @ty)
1218+ pgtype = fixarray (Proxy @n) (pgtype @ty)