Copyright | 2013 Kei Hibino |
---|---|
License | BSD3 |
Maintainer | ex8k.hibino@gmail.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
This module defines typed SQL.
- newtype Query p a = Query {}
- unsafeTypedQuery :: String -> Query p a
- relationalQuery' :: Relation p r -> QuerySuffix -> Query p r
- relationalQuery :: Relation p r -> Query p r
- relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String
- data KeyUpdate p a = KeyUpdate {
- updateKey :: Pi a p
- untypeKeyUpdate :: String
- unsafeTypedKeyUpdate :: Pi a p -> String -> KeyUpdate p a
- typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p a
- typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r
- newtype Update p = Update {}
- unsafeTypedUpdate :: String -> Update p
- typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p
- typedUpdate :: Table r -> UpdateTarget p r -> Update p
- derivedUpdate' :: TableDerivable r => Config -> UpdateTargetContext p r -> Update p
- derivedUpdate :: TableDerivable r => UpdateTargetContext p r -> Update p
- typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p)
- restrictedUpdateAllColumn :: PersistableWidth r => Table r -> RestrictionContext p r -> Update (r, p)
- restrictedUpdateTableAllColumn :: (PersistableWidth r, TableDerivable r) => Relation () r -> RestrictionContext p r -> Update (r, p)
- updateSQL :: Config -> Table r -> UpdateTarget p r -> String
- data Insert a = Insert {}
- unsafeTypedInsert' :: String -> String -> Int -> Insert a
- unsafeTypedInsert :: String -> Insert a
- typedInsert' :: Config -> Table r -> Pi r r' -> Insert r'
- typedInsert :: Table r -> Pi r r' -> Insert r'
- derivedInsert :: TableDerivable r => Pi r r' -> Insert r'
- newtype InsertQuery p = InsertQuery {}
- unsafeTypedInsertQuery :: String -> InsertQuery p
- typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p
- insertQuerySQL :: Config -> Table r -> Pi r r' -> Relation p r' -> String
- newtype Delete p = Delete {}
- unsafeTypedDelete :: String -> Delete p
- typedDelete' :: Config -> Table r -> Restriction p r -> Delete p
- typedDelete :: Table r -> Restriction p r -> Delete p
- derivedDelete' :: TableDerivable r => Config -> RestrictionContext p r -> Delete p
- derivedDelete :: TableDerivable r => RestrictionContext p r -> Delete p
- deleteSQL :: Config -> Table r -> Restriction p r -> String
- class UntypeableNoFetch s where
- untypeNoFetch :: s p -> String
Typed query statement
Query type with place-holder parameter p
and query result type a
.
Unsafely make typed Query
from SQL string.
relationalQuery' :: Relation p r -> QuerySuffix -> Query p r Source
relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String Source
From Relation
into untyped SQL query string.
Typed update statement
Update type with key type p
and update record type a
.
Columns to update are record columns other than key columns,
So place-holder parameter type is the same as record type a
.
KeyUpdate | |
|
unsafeTypedKeyUpdate :: Pi a p -> String -> KeyUpdate p a Source
Unsafely make typed KeyUpdate
from SQL string.
typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p a Source
typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r Source
Update type with place-holder parameter p
.
unsafeTypedUpdate :: String -> Update p Source
Unsafely make typed Update
from SQL string.
typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p Source
Make typed Update
from Config
, Table
and UpdateTarget
.
typedUpdate :: Table r -> UpdateTarget p r -> Update p Source
Make typed Update
using defaultConfig
, Table
and UpdateTarget
.
derivedUpdate' :: TableDerivable r => Config -> UpdateTargetContext p r -> Update p Source
Make typed Update
from Config
, derived table and UpdateTargetContext
derivedUpdate :: TableDerivable r => UpdateTargetContext p r -> Update p Source
Make typed Update
from defaultConfig
, derived table and UpdateTargetContext
typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p) Source
Make typed Update
from Table
and Restriction
.
Update target is all column.
restrictedUpdateAllColumn Source
:: PersistableWidth r | |
=> Table r | |
-> RestrictionContext p r |
|
-> Update (r, p) |
restrictedUpdateTableAllColumn :: (PersistableWidth r, TableDerivable r) => Relation () r -> RestrictionContext p r -> Update (r, p) Source
updateSQL :: Config -> Table r -> UpdateTarget p r -> String Source
Make untyped update SQL string from Table
and UpdateTarget
.
Typed insert statement
Insert type to insert record type a
.
unsafeTypedInsert' :: String -> String -> Int -> Insert a Source
Unsafely make typed Insert
from single insert and chunked insert SQL.
unsafeTypedInsert :: String -> Insert a Source
Unsafely make typed Insert
from single insert SQL.
typedInsert :: Table r -> Pi r r' -> Insert r' Source
derivedInsert :: TableDerivable r => Pi r r' -> Insert r' Source
Table type inferred Insert
.
newtype InsertQuery p Source
InsertQuery type.
UntypeableNoFetch InsertQuery Source | |
Show (InsertQuery p) Source | Show insert SQL string. |
unsafeTypedInsertQuery :: String -> InsertQuery p Source
Unsafely make typed InsertQuery
from SQL string.
typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p Source
Make typed InsertQuery
from columns selector Table
, Pi
and Relation
with configuration parameter.
typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p Source
Make typed InsertQuery
from columns selector Table
, Pi
and Relation
.
derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p Source
Table type inferred InsertQuery
.
Typed delete statement
Delete type with place-holder parameter p
.
unsafeTypedDelete :: String -> Delete p Source
Unsafely make typed Delete
from SQL string.
typedDelete' :: Config -> Table r -> Restriction p r -> Delete p Source
Make typed Delete
from Config
, Table
and Restriction
.
typedDelete :: Table r -> Restriction p r -> Delete p Source
Make typed Delete
from Table
and Restriction
.
derivedDelete' :: TableDerivable r => Config -> RestrictionContext p r -> Delete p Source
derivedDelete :: TableDerivable r => RestrictionContext p r -> Delete p Source
Make typed Delete
from defaultConfig
, derived table and RestrictContext
deleteSQL :: Config -> Table r -> Restriction p r -> String Source
Make untyped delete SQL string from Table
and Restriction
.
Generalized interfaces
class UntypeableNoFetch s where Source
Untype interface for typed no-result type statments
with single type parameter which represents place-holder parameter p
.
untypeNoFetch :: s p -> String Source