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

Copyright2013 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Database.Relational.Query.Constraint

Contents

Description

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.

Synopsis

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.

unsafeDefineConstraintKey Source

Arguments

:: 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 r Source

Get table constraint KeyConstraint proof object from constraint Key.

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

Get projection path proof object from constraint Key.

Derivation rules

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

Derive Unique constraint Key from Primary constraint Key

Inference rules

class PersistableWidth ct => HasConstraintKey c r ct where Source

Constraint Key inference interface.

Methods

constraintKey :: Key c r ct Source

Infer constraint key.

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

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.