mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2025-01-07 05:36:30 +03:00
Update haddocks.
This commit is contained in:
parent
cd4dd0a83a
commit
e184e5a1d8
@ -30,5 +30,6 @@ type Restrict = Trans.Restrict Identity
|
||||
-- restricted :: a -> Restrict a
|
||||
-- restricted = restrict . Identity
|
||||
|
||||
-- | Run 'Restrict' to get SQL WHERE clause.
|
||||
expandPrepend :: Restrict a -> (a, WherePrepend)
|
||||
expandPrepend = runIdentity . extractWheres
|
||||
|
@ -25,6 +25,7 @@ import Database.Relational.Query.Projectable (PlaceHolders)
|
||||
import Database.Relational.Query.Monad.Trans.Restrict (prependWhere)
|
||||
import Database.Relational.Query.Monad.Restrict (Restrict, expandPrepend)
|
||||
|
||||
-- | Restriction type with place-holder parameter 'p' and projection record type 'r'.
|
||||
newtype Restriction p r = Restriction (Projection r -> Restrict ())
|
||||
|
||||
-- | Finalize 'Restrict' monad and generate 'Restriction'.
|
||||
|
@ -97,9 +97,11 @@ insertSQL :: Table r -- ^ Table metadata
|
||||
-> String -- ^ Result SQL
|
||||
insertSQL tbl = insertSQL' (name tbl) (columns tbl)
|
||||
|
||||
-- | Generate all column delete SQL by specified table. Untyped table version.
|
||||
deleteSQL' :: String -> ShowS
|
||||
deleteSQL' table = (SQL.unwordsSQL [DELETE, FROM, SQL.word table] ++)
|
||||
|
||||
-- | Generate all column delete SQL by specified table.
|
||||
deleteSQL :: Table r -- ^ Table metadata
|
||||
-> ShowS -- ^ Result SQL
|
||||
deleteSQL = deleteSQL' . name
|
||||
|
@ -72,6 +72,7 @@ typedUpdate tbl = unsafeTypedUpdate . updateSQL tbl
|
||||
instance Show (Update p a) where
|
||||
show = untypeUpdate
|
||||
|
||||
-- | Make typed 'Update' from 'Table' and 'Restriction'.
|
||||
restrictedUpdate :: Table r -> Restriction p r -> Update p r
|
||||
restrictedUpdate tbl r = unsafeTypedUpdate . updateAllColumnsSQL tbl
|
||||
. sqlWhereFromRestriction tbl r $ ""
|
||||
@ -104,6 +105,7 @@ unsafeTypedDelete = Delete
|
||||
instance Show (Delete p a) where
|
||||
show = untypeDelete
|
||||
|
||||
-- | Make typed 'Delete' from 'Table' and 'Restriction'.
|
||||
restrictedDelete :: Table r -> Restriction p r -> Delete p a
|
||||
restrictedDelete tbl r = unsafeTypedDelete . deleteSQL tbl
|
||||
. sqlWhereFromRestriction tbl r $ ""
|
||||
|
@ -24,6 +24,7 @@ library
|
||||
Database.HDBC.Record.Persistable
|
||||
Database.HDBC.Record.Singleton
|
||||
Database.HDBC.Record.TH
|
||||
Database.HDBC.Record.Statement
|
||||
Database.HDBC.Record.Query
|
||||
Database.HDBC.Query.TH
|
||||
Database.HDBC.SqlValueExtra
|
||||
|
Loading…
Reference in New Issue
Block a user