on dev help sign in
some fixes
commite50f5ca4dff18caadb6c34b81742fdd589d617e0 authorEitan Chatav <eitan@Eitans-MacBook-Pro.local> dateFri 1 Mar 2019, 14:20 (8 years ago) parent9d8d46e
2 files changed+14−13
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+7−6 squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+7−7
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+7−6
@@ -12,7 +12,7 @@ Stability: experimental
1212
1313This module provides binary encoding and decoding between Haskell and PostgreSQL types.
1414
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
1616do not need to define your own instances to decode retrieved rows into Haskell values or
1717to encode Haskell values into statement parameters.
1818
@@ -24,7 +24,7 @@ Let's see some examples. We'll need some imports
2424>>> import Control.Monad.Base (liftBase)
2525>>> import Squeal.PostgreSQL
2626
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
2828round trip query.
2929
3030>>> data Row = Row { col1 :: Int16, col2 :: Text, col3 :: Maybe Bool } deriving (Eq, GHC.Generic)
@@ -125,9 +125,9 @@ let
125125 createTypeCompositeFrom @Person #person
126126:}
127127
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@
129129with 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.
131131
132132>>> :{
133133data Row = Row
@@ -210,6 +210,7 @@ module Squeal.PostgreSQL.Binary
210210 , Composite (..)
211211 , Enumerated (..)
212212 , VarArray (..)
213+ , FixArray (..)
213214 -- * Encoding
214215 , ToParam (..)
215216 , ToParams (..)
@@ -424,7 +425,7 @@ instance
424425
425426-- | A `ToParams` constraint generically sequences the encodings of `Type`s
426427-- 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
428429-- which in turn provide `ToParams` instances.
429430class SListI tys => ToParams (x :: Type) (tys :: [NullityType]) where
430431 -- | >>> type Params = '[ 'NotNull 'PGbool, 'Null 'PGint2]
@@ -611,7 +612,7 @@ instance
611612-- | A `FromRow` constraint generically sequences the parsings of the columns
612613-- of a `RowType` into the fields of a record `Type` provided they have
613614-- 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
615616-- provide `FromRow` instances.
616617class SListI result => FromRow (result :: RowType) y where
617618 -- | >>> :set -XOverloadedStrings
squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+7−7
@@ -402,8 +402,8 @@ instance RenderSQL (ColumnExpression grp schemas params from column) where
402402-- serial sequence number. However, any expression using the table's columns
403403-- is allowed. Only rows that were successfully inserted or updated or
404404-- deleted will be returned. For example, if a row was locked
405−-- but not updated because an `OnConflictDoUpdate` condition was not satisfied,
406−-- the row will not be returned. `ReturningStar` will return all columns
405+-- but not updated because an `OnConflict` `DoUpdate` condition was not satisfied,
406+-- the row will not be returned. `Returning` `Star` will return all columns
407407-- in the row. Use @Returning Nil@ in the common case where no return
408408-- values are desired.
409409newtype ReturningClause commons schemas params from row =
@@ -422,8 +422,8 @@ pattern Returning_ list = Returning (List list)
422422
423423-- | A `ConflictClause` specifies an action to perform upon a constraint
424424-- violation. `OnConflictDoRaise` will raise an error.
425−-- `OnConflictDoNothing` simply avoids inserting a row.
426−-- `OnConflictDoUpdate` updates the existing row that conflicts with the row
425+-- `OnConflict` `DoNothing` simply avoids inserting a row.
426+-- `OnConflict` `DoUpdate` updates the existing row that conflicts with the row
427427-- proposed for insertion.
428428data ConflictClause tab commons schemas params table where
429429 OnConflictDoRaise :: ConflictClause tab commons schemas params table
@@ -572,9 +572,9 @@ deleteFrom_ tab wh = deleteFrom tab NoUsing wh (Returning_ Nil)
572572
573573-- | This has the behaviour of a cartesian product, taking all
574574-- possible combinations between @left@ and @right@ - exactly like a
575−-- CROSS JOIN. Used when no "CROSS JOIN" syntax is required but simply
576−-- a comma separated list of tables. Typical case is the `USING` clause
577−-- of a DELETE query.
575+-- `crossJoin`. Used when no `crossJoin` syntax is required but simply
576+-- a comma separated list of tables. Typical case is the `UsingClause`
577+-- of a `deleteFrom` query.
578578also
579579 :: FromClause outer commons schemas params right
580580 -- ^ right