rel8-internal
Safe HaskellNone
LanguageHaskell2010

Rel8.Internal.Type.Composite

Synopsis

Documentation

newtype Composite a Source #

A deriving-via helper type for column types that store a Haskell product type in a single Postgres column using a Postgres composite type.

Note that this must map to a specific extant type in your database's schema (created with CREATE TYPE). Use DBComposite to specify the name of this Postgres type and the names of the individual fields (for projecting with decompose).

Constructors

Composite a 

Instances

Instances details
DBComposite a => DBType (Composite a) Source # 
Instance details

Defined in Rel8.Internal.Type.Composite

(DBComposite a, EqTable (HKD a Expr)) => DBEq (Composite a) Source # 
Instance details

Defined in Rel8.Internal.Type.Composite

(DBComposite a, OrdTable (HKD a Expr)) => DBMax (Composite a) Source # 
Instance details

Defined in Rel8.Internal.Type.Composite

(DBComposite a, OrdTable (HKD a Expr)) => DBMin (Composite a) Source # 
Instance details

Defined in Rel8.Internal.Type.Composite

(DBComposite a, OrdTable (HKD a Expr)) => DBOrd (Composite a) Source # 
Instance details

Defined in Rel8.Internal.Type.Composite

class (DBType a, HKDable a) => DBComposite a where Source #

DBComposite is used to associate composite type metadata with a Haskell type.

Methods

compositeFields :: HKD a Name Source #

The names of all fields in the composite type that a maps to.

compositeTypeName :: QualifiedName Source #

The name of the composite type that a maps to.

compose :: DBComposite a => HKD a Expr -> Expr a Source #

Collapse a HKD into a PostgreSQL composite type.

HKD values are represented in queries by having a column for each field in the corresponding Haskell type. compose collapses these columns into a single column expression, by combining them into a PostgreSQL composite type.

decompose :: DBComposite a => Expr a -> HKD a Expr Source #

Expand a composite type into a HKD.

decompose is the inverse of compose.