Copyright | 2013-2018 Kei Hibino |
---|---|
License | BSD3 |
Maintainer | ex8k.hibino@gmail.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
This module contains templates to generate Haskell record types and HDBC instances correspond to RDB table schema.
Synopsis
- makeRelationalRecord :: Name -> Q [Dec]
- makeRelationalRecord' :: Config -> Name -> Q [Dec]
- defineTableDefault' :: Config -> String -> String -> [(String, TypeQ)] -> [Name] -> Q [Dec]
- defineTableDefault :: Config -> String -> String -> [(String, TypeQ)] -> [Name] -> [Int] -> Maybe Int -> Q [Dec]
- defineTableFromDB' :: IConnection conn => IO conn -> Driver conn -> String -> String -> [(String, TypeQ)] -> [Name] -> Q [Dec]
- defineTableFromDB :: IConnection conn => IO conn -> Driver conn -> String -> String -> [Name] -> Q [Dec]
- inlineVerifiedQuery :: IConnection conn => IO conn -> Name -> Relation p r -> Config -> QuerySuffix -> String -> Q [Dec]
Documentation
Generate all persistable templates against defined record like type constructor.
makeRelationalRecord' Source #
Generate all persistable templates against defined record like type constructor.
:: Config | Configuration to generate query with |
-> String | Schema name |
-> String | Table name |
-> [(String, TypeQ)] | List of column name and type |
-> [Name] | Derivings |
-> Q [Dec] | Result declaration |
Generate all HDBC templates about table except for constraint keys.
:: Config | Configuration to generate query with |
-> String | Schema name |
-> String | Table name |
-> [(String, TypeQ)] | List of column name and type |
-> [Name] | Derivings |
-> [Int] | Indexes to represent primary key |
-> Maybe Int | Index of not-null key |
-> Q [Dec] | Result declaration |
Generate all HDBC templates about table.
:: IConnection conn | |
=> IO conn | Connect action to system catalog database |
-> Driver conn | Driver definition |
-> String | Schema name |
-> String | Table name |
-> [(String, TypeQ)] | Additional column-name and column-type mapping to overwrite default |
-> [Name] | Derivings |
-> Q [Dec] | Result declaration |
Generate all HDBC templates using system catalog informations with specified config.
:: IConnection conn | |
=> IO conn | Connect action to system catalog database |
-> Driver conn | Driver definition |
-> String | Schema name |
-> String | Table name |
-> [Name] | Derivings |
-> Q [Dec] | Result declaration |
Generate all HDBC templates using system catalog informations.
:: IConnection conn | |
=> IO conn | Connect action to system catalog database |
-> Name | Top-level variable name which has |
-> Relation p r | Object which has |
-> Config | Configuration to generate SQL |
-> QuerySuffix | suffix SQL words |
-> String | Variable name to define as inlined query |
-> Q [Dec] | Result declarations |
Verify composed Query
and inline it in compile type.