on dev help sign in
some fixes
e50f5caEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+7−6
@@ -12,7 +12,7 @@ Stability: experimental
12
12
13This module provides binary encoding and decoding between Haskell and PostgreSQL types.
13This module provides binary encoding and decoding between Haskell and PostgreSQL types.
14
14
15−Instances are governed by the `Generic` and `HasDatatypeInfo` typeclasses, so you absolutely
15+Instances are governed by the `SOP.Generic` and `SOP.HasDatatypeInfo` typeclasses, so you absolutely
16do not need to define your own instances to decode retrieved rows into Haskell values or
16do not need to define your own instances to decode retrieved rows into Haskell values or
17to encode Haskell values into statement parameters.
17to encode Haskell values into statement parameters.
18
18
@@ -24,7 +24,7 @@ Let's see some examples. We'll need some imports
24>>> import Control.Monad.Base (liftBase)
24>>> import Control.Monad.Base (liftBase)
25>>> import Squeal.PostgreSQL
25>>> import Squeal.PostgreSQL
26
26
27−Define a Haskell datatype `Row` that will serve as both the input and output of a simple
27+Define a Haskell datatype @Row@ that will serve as both the input and output of a simple
28round trip query.
28round trip query.
29
29
30>>> data Row = Row { col1 :: Int16, col2 :: Text, col3 :: Maybe Bool } deriving (Eq, GHC.Generic)
30>>> data Row = Row { col1 :: Int16, col2 :: Text, col3 :: Maybe Bool } deriving (Eq, GHC.Generic)
@@ -125,9 +125,9 @@ let
125 createTypeCompositeFrom @Person #person
125 createTypeCompositeFrom @Person #person
126:}
126:}
127
127
128−Let's demonstrate how to associate our Haskell types `Schwarma` and `Person`
128+Let's demonstrate how to associate our Haskell types @Schwarma@ and @Person@
129with enumerated, composite or json types in Postgres. First create a Haskell
129with enumerated, composite or json types in Postgres. First create a Haskell
130−`Row` type using the `Enumerated`, `Composite` and `Json` newtypes as fields.
130+@Row@ type using the `Enumerated`, `Composite` and `Json` newtypes as fields.
131
131
132>>> :{
132>>> :{
133data Row = Row
133data Row = Row
@@ -210,6 +210,7 @@ module Squeal.PostgreSQL.Binary
210 , Composite (..)
210 , Composite (..)
211 , Enumerated (..)
211 , Enumerated (..)
212 , VarArray (..)
212 , VarArray (..)
213+ , FixArray (..)
213 -- * Encoding
214 -- * Encoding
214 , ToParam (..)
215 , ToParam (..)
215 , ToParams (..)
216 , ToParams (..)
@@ -424,7 +425,7 @@ instance
424
425
425-- | A `ToParams` constraint generically sequences the encodings of `Type`s
426-- | A `ToParams` constraint generically sequences the encodings of `Type`s
426-- of the fields of a tuple or record to a row of `ColumnType`s. You should
427-- of the fields of a tuple or record to a row of `ColumnType`s. You should
427−-- not define instances of `ToParams`. Instead define `Generic` instances
428+-- not define instances of `ToParams`. Instead define `SOP.Generic` instances
428-- which in turn provide `ToParams` instances.
429-- which in turn provide `ToParams` instances.
429class SListI tys => ToParams (x :: Type) (tys :: [NullityType]) where
430class SListI tys => ToParams (x :: Type) (tys :: [NullityType]) where
430 -- | >>> type Params = '[ 'NotNull 'PGbool, 'Null 'PGint2]
431 -- | >>> type Params = '[ 'NotNull 'PGbool, 'Null 'PGint2]
@@ -611,7 +612,7 @@ instance
611-- | A `FromRow` constraint generically sequences the parsings of the columns
612-- | A `FromRow` constraint generically sequences the parsings of the columns
612-- of a `RowType` into the fields of a record `Type` provided they have
613-- of a `RowType` into the fields of a record `Type` provided they have
613-- the same field names. You should not define instances of `FromRow`.
614-- the same field names. You should not define instances of `FromRow`.
614−-- Instead define `Generic` and `HasDatatypeInfo` instances which in turn
615+-- Instead define `SOP.Generic` and `SOP.HasDatatypeInfo` instances which in turn
615-- provide `FromRow` instances.
616-- provide `FromRow` instances.
616class SListI result => FromRow (result :: RowType) y where
617class SListI result => FromRow (result :: RowType) y where
617 -- | >>> :set -XOverloadedStrings
618 -- | >>> :set -XOverloadedStrings
squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+7−7
@@ -402,8 +402,8 @@ instance RenderSQL (ColumnExpression grp schemas params from column) where
402-- serial sequence number. However, any expression using the table's columns
402-- serial sequence number. However, any expression using the table's columns
403-- is allowed. Only rows that were successfully inserted or updated or
403-- is allowed. Only rows that were successfully inserted or updated or
404-- deleted will be returned. For example, if a row was locked
404-- deleted will be returned. For example, if a row was locked
405−-- but not updated because an `OnConflictDoUpdate` condition was not satisfied,
405+-- but not updated because an `OnConflict` `DoUpdate` condition was not satisfied,
406−-- the row will not be returned. `ReturningStar` will return all columns
406+-- the row will not be returned. `Returning` `Star` will return all columns
407-- in the row. Use @Returning Nil@ in the common case where no return
407-- in the row. Use @Returning Nil@ in the common case where no return
408-- values are desired.
408-- values are desired.
409newtype ReturningClause commons schemas params from row =
409newtype ReturningClause commons schemas params from row =
@@ -422,8 +422,8 @@ pattern Returning_ list = Returning (List list)
422
422
423-- | A `ConflictClause` specifies an action to perform upon a constraint
423-- | A `ConflictClause` specifies an action to perform upon a constraint
424-- violation. `OnConflictDoRaise` will raise an error.
424-- violation. `OnConflictDoRaise` will raise an error.
425−-- `OnConflictDoNothing` simply avoids inserting a row.
425+-- `OnConflict` `DoNothing` simply avoids inserting a row.
426−-- `OnConflictDoUpdate` updates the existing row that conflicts with the row
426+-- `OnConflict` `DoUpdate` updates the existing row that conflicts with the row
427-- proposed for insertion.
427-- proposed for insertion.
428data ConflictClause tab commons schemas params table where
428data ConflictClause tab commons schemas params table where
429 OnConflictDoRaise :: ConflictClause tab commons schemas params table
429 OnConflictDoRaise :: ConflictClause tab commons schemas params table
@@ -572,9 +572,9 @@ deleteFrom_ tab wh = deleteFrom tab NoUsing wh (Returning_ Nil)
572
572
573-- | This has the behaviour of a cartesian product, taking all
573-- | This has the behaviour of a cartesian product, taking all
574-- possible combinations between @left@ and @right@ - exactly like a
574-- possible combinations between @left@ and @right@ - exactly like a
575−-- CROSS JOIN. Used when no "CROSS JOIN" syntax is required but simply
575+-- `crossJoin`. Used when no `crossJoin` syntax is required but simply
576−-- a comma separated list of tables. Typical case is the `USING` clause
576+-- a comma separated list of tables. Typical case is the `UsingClause`
577−-- of a DELETE query.
577+-- of a `deleteFrom` query.
578also
578also
579 :: FromClause outer commons schemas params right
579 :: FromClause outer commons schemas params right
580 -- ^ right
580 -- ^ right