hasql-postgresql-types 0.1 → 0.1.0.1
raw patch · 2 files changed
+10/−2 lines, 2 files
Files
- README.md +4/−0
- hasql-postgresql-types.cabal +6/−2
README.md view
@@ -6,6 +6,10 @@ Integration of ["hasql"](https://github.com/nikita-volkov/hasql) with ["postgresql-types"](https://github.com/nikita-volkov/postgresql-types) via the `IsScalar` typeclass from ["postgresql-types-algebra"](https://github.com/nikita-volkov/postgresql-types-algebra). Provides automatic encoder and decoder generation for precise PostgreSQL scalar types. +## Motivation++The standard "hasql" codecs use common Haskell types like `Text`, `DiffTime`, `UTCTime`, etc. However these types do not always map precisely to PostgreSQL types. E.g., the PostgreSQL `interval` type carries information about months, years and microseconds, while the Haskell `DiffTime` type only represents a time difference in picoseconds. Such mismatches can lead to data loss or unexpected behavior. The ["postgresql-types"](https://github.com/nikita-volkov/postgresql-types) library addresses such issues by providing precise Haskell representations for PostgreSQL types. This package integrates it with "hasql". It also provides a class-based polymorphic interface for defining "hasql" `Value` codecs.+ ## Usage ```haskell
hasql-postgresql-types.cabal view
@@ -1,11 +1,15 @@ cabal-version: 3.0 name: hasql-postgresql-types-version: 0.1+version: 0.1.0.1 category: PostgreSQL, Codecs, Hasql synopsis: Integration of "hasql" with "postgresql-types" description: Provides automatic encoder and decoder generation for ["hasql"](https://hackage.haskell.org/package/hasql),- supporting all PostgreSQL standard types defined in the ["postgresql-types"](https://hackage.haskell.org/package/postgresql-types) package.+ supporting all PostgreSQL types defined in the ["postgresql-types"](https://hackage.haskell.org/package/postgresql-types) package.++ == Motivation++ The standard "hasql" codecs use common Haskell types like `Text`, `DiffTime`, `UTCTime`, etc. However these types do not always map precisely to PostgreSQL types. E.g., the PostgreSQL `interval` type carries information about months, years and microseconds, while the Haskell `DiffTime` type only represents a time difference in picoseconds. Such mismatches can lead to data loss or unexpected behavior. The ["postgresql-types"](https://github.com/nikita-volkov/postgresql-types) library addresses such issues by providing precise Haskell representations for PostgreSQL types. This package integrates it with "hasql". It also provides a class-based polymorphic interface for defining "hasql" `Value` codecs. homepage: https://github.com/nikita-volkov/hasql-postgresql-types bug-reports: https://github.com/nikita-volkov/hasql-postgresql-types/issues