relational-query- Typeful, Modular, Relational, algebraic query engine

Safe HaskellNone




This module provides proof object definitions of constraint key. Difference between this module and Database.Record.KeyConstraint is typed constraint key column definition is included in this module.


Constraint Key proof object

data Key c r ct Source

Constraint Key proof object. Constraint type c, record type r and columns type ct.

indexes :: Key c r ct -> [Int]Source

Index of key which specifies constraint key.



:: PersistableWidth ct 
=> [Int]

Key indexes which specify this constraint key

-> Key c r ct

Result constraint key proof object

Unsafely generate constraint Key proof object using specified key index.

tableConstraint :: Key c r ct -> KeyConstraint c rSource

Get table constraint KeyConstraint proof object from constraint Key.

projectionKey :: Key c r ct -> Pi r ctSource

Get projection path proof object from constraint Key.

Derivation rules

uniqueKey :: PersistableWidth ct => Key Primary r ct -> Key Unique r ctSource

Derive Unique constraint Key from Primary constraint Key

Inference rules

class PersistableWidth ct => HasConstraintKey c r ct whereSource

Constraint Key inference interface.


constraintKey :: Key c r ctSource

Infer constraint key.

derivedUniqueKey :: HasConstraintKey Primary r ct => Key Unique r ctSource

Infered Unique constraint Key. Record type r has unique key which type is ct derived from primay key.

Constraint types

data Primary

Constraint type. Primary key.

data Unique

Constraint type. Unique key.