Copyright | 2013 Kei Hibino |
---|---|
License | BSD3 |
Maintainer | ex8k.hibino@gmail.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
This is integrated module which contains types to represent table constraints and interfaces to bind between SQL database values and Haskell records.
- module Database.Record.KeyConstraint
- module Database.Record.Persistable
- module Database.Record.FromSql
- module Database.Record.ToSql
Concepts
On most drivers for SQL database, we need to write or read untyped SQL value sequence when accessing databases.
This library maps between list of untyped SQL type and Haskell record type using type classes.
Binding between SQL values and Haskell records
You will need to implement instances of FromSql
and ToSql
class
to bind between SQL database values and Haskell records.
You can use Database.Record.TH module in this package to generate instances from SQL database record column names and types.
Constraints used for RecordFromSql
inference
You will need to implement instances of
HasColumnConstraint
NotNull
which is a premise
to infer RecordFromSql
proof object using ToSql
q
(Maybe
a) instance.
This proof object cat convert from SQL type into Maybe
typed record
when dealing with outer joined query.
Modules which provide proof objects
Table constraint specified by keys
Convert between Haskell type and list of SQL type
module Database.Record.Persistable
Convert from list of SQL type
module Database.Record.FromSql
Convert into list of SQL type
module Database.Record.ToSql