postgresql-simple-0.6.5: Mid-Level PostgreSQL client library
Safe Haskell None
Language Haskell2010

Database.PostgreSQL.Simple.Newtypes

Description

Module with newtypes suitable to usage with DerivingVia or standalone.

The newtypes are named after packages they wrap.

Synopsis

Documentation

newtype Aeson a Source #

A newtype wrapper with ToField and FromField instances based on ToJSON and FromJSON type classes from aeson .

Example using DerivingVia :

data Foo = Foo Int String
  deriving stock (Eq, Show, Generic)            -- GHC built int
  deriving anyclass (FromJSON, ToJSON)          -- Derived using GHC Generics
  deriving (ToField, FromField) via Aeson Foo   -- DerivingVia

Example using Aeson newtype directly, for more ad-hoc queries

execute conn "INSERT INTO tbl (fld) VALUES (?)" (Only (Aeson x))

Since: 0.6.3

Constructors

Aeson a