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

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

Database.Relational.Query.Derives

Contents

Description

This module defines typed SQLs derived from type informations.

Synopsis

Query derivation

specifiedKey Source

Arguments

:: PersistableWidth p 
=> Pi a p

Unique key proof object which record type is a and key type is p.

-> Relation () a

Relation to add restriction.

-> Relation p a

Result restricted Relation

Query restricted with specified key.

unique Source

Arguments

:: PersistableWidth p 
=> Key Unique a p

Unique key proof object which record type is a and key type is p.

-> Relation () a

Relation to add restriction.

-> Relation p a

Result restricted Relation

Query restricted with specified unique key.

primary' Source

Arguments

:: PersistableWidth p 
=> Key Primary a p

Primary key proof object which record type is a and key type is p.

-> Relation () a

Relation to add restriction.

-> Relation p a

Result restricted Relation

Query restricted with specified primary key.

primary Source

Arguments

:: HasConstraintKey Primary a p 
=> Relation () a

Relation to add restriction.

-> Relation p a

Result restricted Relation

Query restricted with inferred primary key.

Update derivation

updateByConstraintKey Source

Arguments

:: Table r

Table to update

-> Key c r p

Key with constraint c, record type r and columns type p

-> KeyUpdate p r

Result typed Update

Typed KeyUpdate using specified constraint key.

primaryUpdate Source

Arguments

:: HasConstraintKey Primary r p 
=> Table r

Table to update

-> KeyUpdate p r

Result typed Update

Typed KeyUpdate using inferred primary key.

updateValuesWithKey :: ToSql q r => Pi r p -> r -> [q] Source

Convert from Haskell type r into SQL value q list expected by update form like

UPDATE table SET c0 = ?, c1 = ?, ..., cn = ? WHERE key0 = ? AND key1 = ? AND key2 = ? ...

using derived RecordToSql proof object.

Derived objects from table

derivedUniqueRelation Source

Arguments

:: TableDerivable r 
=> Key Unique r k

Unique key proof object which record type is a and key type is p.

-> Projection c k

Unique key value to specify.

-> UniqueRelation () c r

Result restricted Relation

UniqueRelation inferred from table.