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

Portabilityunknown
Stabilityexperimental
Maintainerex8k.hibino@gmail.com
Safe HaskellNone

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.

unsafeDefineConstraintKeySource

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 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.

Methods

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.