@hackage hasql-postgresql-types0.1
Integration of "hasql" with "postgresql-types"
Installation
Dependencies (7)
- base >=4.11 && <5
- hasql ^>=1.10.1
- postgresql-types-algebra ^>=0.1
- ptr-peeker ^>=0.1.0.1
- ptr-poker ^>=0.1.3
- tagged ^>=0.8.9 Show all…
Dependents (2)
@hackage/ihp, @hackage/ihp-datasync
hasql-postgresql-types
Integration of "hasql" with "postgresql-types" via the IsScalar typeclass from "postgresql-types-algebra".
Provides automatic encoder and decoder generation for precise PostgreSQL scalar types.
Usage
import Hasql.PostgresqlTypes (encoder, decoder)
import qualified PostgresqlTypes as Pt
import qualified Hasql.Statement as Statement
import qualified Hasql.Encoders as Encoders
import qualified Hasql.Decoders as Decoders
myStatement :: Statement.Statement Pt.Timestamptz [Pt.Timestamptz]
myStatement = Statement.preparable sql enc dec
where
sql = "SELECT $1::timestamptz"
enc = Encoders.param (Encoders.nonNullable encoder)
dec = Decoders.rowList (Decoders.column (Decoders.nonNullable decoder))