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))
Constructors
Aeson a
Instances6Functor, Eq, Read, Show, FromField, ToField
Functor AesonDefined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.NewtypesEq a => Eq (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.NewtypesRead a => Read (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.NewtypesShow a => Show (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes(FromJSON a, Typeable a) => FromField (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.NewtypesToJSON a => ToField (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes