pg-entity-0.0.4.3: A pleasant PostgreSQL layer
Copyright© Koz Ross 2021
LicenseMIT
Maintainerkoz.ross@retro-freedom.nz
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.PostgreSQL.Entity.Internal.QQ

Description

A quasi-quoter for Fields, supporting optional types.

There is little reason to import this module directly; instead, import Entity, which re-exports the field quasiquoter.

Synopsis

Documentation

field :: QuasiQuoter Source #

A quasi-quoter for safely constructing Fields.

Example:

instance Entity BlogPost where
  tableName  = "blogposts"
  primaryKey = [field| blogpost_id |]
  fields = [ [field| blogpost_id |]
           , [field| author_id |]
           , [field| uuid_list :: uuid[] |] -- ← This is where we specify an optional PostgreSQL type annotation
           , [field| title |]
           , [field| content |]
           , [field| created_at |]
           ]

Since: 0.1.0.0