hasql-postgresql-types 0.2.0.1 → 0.2.1.0
raw patch · 4 files changed
+30/−17 lines, 4 filesdep ~postgresql-typesdep ~postgresql-types-algebra
Dependency ranges changed: postgresql-types, postgresql-types-algebra
Files
- CHANGELOG.md +10/−5
- hasql-postgresql-types.cabal +3/−3
- src/library/Hasql/PostgresqlTypes.hs +10/−2
- src/library/Hasql/PostgresqlTypes/Core.hs +7/−7
CHANGELOG.md view
@@ -1,17 +1,22 @@-# Changelog+# v0.2.1.0 -## 0.2+## Non-breaking -*Breaking changes*+- Upgraded to `postgresql-types-algebra` v0.2 and `postgresql-types` v0.1.5.+- Added `IsScalar` instances for `Citext` and `Geometry`. +# v0.2++## Breaking+ - Removed the `encoder` and `decoder` functions from `Hasql.PostgresqlTypes`. Codec access is now done via the `IsScalar` typeclass from the new [`hasql-mapping`](https://hackage.haskell.org/package/hasql-mapping) dependency. Import `Hasql.PostgresqlTypes ()` to bring the instances into scope, then use `Hasql.Mapping.IsScalar.encoder` and `Hasql.Mapping.IsScalar.decoder` (or the re-exports from `Hasql.Mapping`). - Bumped `hasql` lower bound from `1.10.1` to `1.10.3`. -*New features*+## Non-breaking - Added `IsScalar` instances for all PostgreSQL types defined in [`postgresql-types`](https://hackage.haskell.org/package/postgresql-types), including `Tsvector`. - Added new dependencies: [`hasql-mapping`](https://hackage.haskell.org/package/hasql-mapping) and [`postgresql-types`](https://hackage.haskell.org/package/postgresql-types). -## 0.1.0.1+# v0.1.0.1 Initial release.
hasql-postgresql-types.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: hasql-postgresql-types-version: 0.2.0.1+version: 0.2.1.0 category: PostgreSQL, Codecs, Hasql synopsis: Integration of "hasql" with "postgresql-types" description:@@ -104,8 +104,8 @@ base >=4.11 && <5, hasql ^>=1.10.3, hasql-mapping ^>=0.1,- postgresql-types ^>=0.1,- postgresql-types-algebra ^>=0.1,+ postgresql-types ^>=0.1.5,+ postgresql-types-algebra ^>=0.2, ptr-peeker >=0.1.0.1 && <0.3, ptr-poker ^>=0.1.3, tagged ^>=0.8.9,
src/library/Hasql/PostgresqlTypes.hs view
@@ -62,6 +62,10 @@ encoder = Core.encoder decoder = Core.decoder +instance IsScalar.IsScalar Citext where+ encoder = Core.encoder+ decoder = Core.decoder+ instance IsScalar.IsScalar Date where encoder = Core.encoder decoder = Core.decoder@@ -74,6 +78,10 @@ encoder = Core.encoder decoder = Core.decoder +instance IsScalar.IsScalar Geometry where+ encoder = Core.encoder+ decoder = Core.decoder+ instance IsScalar.IsScalar Hstore where encoder = Core.encoder decoder = Core.decoder@@ -126,7 +134,7 @@ encoder = Core.encoder decoder = Core.decoder -instance (IsMultirangeElement element) => IsScalar.IsScalar (Multirange element) where+instance (IsMultirangeElement element, IsBinaryPrimitive element) => IsScalar.IsScalar (Multirange element) where encoder = Core.encoder decoder = Core.decoder @@ -150,7 +158,7 @@ encoder = Core.encoder decoder = Core.decoder -instance (IsRangeElement element) => IsScalar.IsScalar (Range element) where+instance (IsRangeElement element, IsBinaryPrimitive element) => IsScalar.IsScalar (Range element) where encoder = Core.encoder decoder = Core.decoder
src/library/Hasql/PostgresqlTypes/Core.hs view
@@ -1,11 +1,11 @@ -- | -- Internal implementation of the hasql encoder and decoder for types--- that implement the 'IsScalar' constraint from+-- that implement the 'IsPrimitive' and 'IsBinaryPrimitive' constraints from -- ["postgresql-types-algebra"](https://hackage.haskell.org/package/postgresql-types-algebra). -- These are used by the 'IsScalar.IsScalar' instances defined in -- "Hasql.PostgresqlTypes". ----- The 'encoder' and 'decoder' functions work with any type having an 'IsScalar' instance,+-- The 'encoder' and 'decoder' functions work with any type having 'IsPrimitive' and 'IsBinaryPrimitive' instances, -- automatically handling binary encoding/decoding and OID resolution. module Hasql.PostgresqlTypes.Core ( encoder,@@ -17,7 +17,7 @@ import Data.Tagged (untag) import qualified Hasql.Decoders as Decoders import qualified Hasql.Encoders as Encoders-import PostgresqlTypes.Algebra (IsScalar (..))+import PostgresqlTypes.Algebra (IsBinaryPrimitive (..), IsPrimitive (..)) import qualified PtrPeeker import qualified PtrPoker.Write as Write import qualified TextBuilder@@ -25,9 +25,9 @@ -- | Hasql value encoder for a PostgreSQL standard type. ----- Generates a Hasql value encoder for any type implementing 'IsScalar'.+-- Generates a Hasql value encoder for any type implementing 'IsPrimitive' and 'IsBinaryPrimitive'. -- The encoder handles type resolution, and binary encoding automatically.-encoder :: forall a. (IsScalar a) => Encoders.Value a+encoder :: forall a. (IsPrimitive a, IsBinaryPrimitive a) => Encoders.Value a encoder = Encoders.custom Nothing@@ -39,9 +39,9 @@ -- | Hasql value decoder for a PostgreSQL standard type. ----- Generates a Hasql value decoder for any type implementing 'IsScalar'.+-- Generates a Hasql value decoder for any type implementing 'IsPrimitive' and 'IsBinaryPrimitive'. -- The decoder handles type resolution, and binary decoding with proper error handling.-decoder :: forall a. (IsScalar a) => Decoders.Value a+decoder :: forall a. (IsPrimitive a, IsBinaryPrimitive a) => Decoders.Value a decoder = Decoders.custom Nothing