| Copyright | 2013 Kei Hibino | 
|---|---|
| License | BSD3 | 
| Maintainer | [email protected] | 
| Stability | experimental | 
| Portability | unknown | 
| Safe Haskell | None | 
| Language | Haskell2010 | 
Database.Relational.Query.Derives
Description
This module defines typed SQLs derived from type informations.
- specifiedKey :: PersistableWidth p => Pi a p -> Relation () a -> Relation p a
- unique :: PersistableWidth p => Key Unique a p -> Relation () a -> Relation p a
- primary' :: PersistableWidth p => Key Primary a p -> Relation () a -> Relation p a
- primary :: HasConstraintKey Primary a p => Relation () a -> Relation p a
- updateByConstraintKey :: Table r -> Key c r p -> KeyUpdate p r
- primaryUpdate :: HasConstraintKey Primary r p => Table r -> KeyUpdate p r
- updateValuesWithKey :: ToSql q r => Pi r p -> r -> [q]
- derivedUniqueRelation :: TableDerivable r => Key Unique r k -> Projection c k -> UniqueRelation () c r
Query derivation
Arguments
| :: PersistableWidth p | |
| => Pi a p | Unique key proof object which record type is  | 
| -> Relation () a | 
 | 
| -> Relation p a | Result restricted  | 
Query restricted with specified key.
Arguments
| :: PersistableWidth p | |
| => Key Unique a p | Unique key proof object which record type is  | 
| -> Relation () a | 
 | 
| -> Relation p a | Result restricted  | 
Query restricted with specified unique key.
Arguments
| :: PersistableWidth p | |
| => Key Primary a p | Primary key proof object which record type is  | 
| -> Relation () a | 
 | 
| -> Relation p a | Result restricted  | 
Query restricted with specified primary key.
Arguments
| :: HasConstraintKey Primary a p | |
| => Relation () a | 
 | 
| -> Relation p a | Result restricted  | 
Query restricted with infered primary key.
Update derivation
Arguments
| :: Table r | 
 | 
| -> Key c r p | Key with constraint  | 
| -> KeyUpdate p r | Result typed  | 
Typed KeyUpdate using specified constraint key.
Arguments
| :: HasConstraintKey Primary r p | |
| => Table r | 
 | 
| -> KeyUpdate p r | Result typed  | 
Typed KeyUpdate using infered 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
Arguments
| :: TableDerivable r | |
| => Key Unique r k | Unique key proof object which record type is  | 
| -> Projection c k | Unique key value to specify. | 
| -> UniqueRelation () c r | Result restricted  | 
UniqueRelation infered from table.