haskelldb-0.10: SQL unwrapper for Haskell.ContentsIndex
Database.HaskellDB.DriverAPI
Portabilityportable
Stabilityexperimental
Maintainerchucky@dtek.chalmers.se
Description
This exports an API that all drivers must conform to. It is used by the end user to load drivers either dynamically or statically.
Synopsis
data DriverInterface = DriverInterface {
connect :: (forall m a . MonadIO m => [(String, String)] -> (Database -> m a) -> m a)
}
MonadIO
defaultdriver :: DriverInterface
getOptions :: Monad m => [String] -> [(String, String)] -> m [String]
getGenerator :: Monad m => [(String, String)] -> m SqlGenerator
Documentation
data DriverInterface
Interface which drivers should implement. The connect function takes some driver specific name, value pairs use to setup the database connection, and a database action to run.
Constructors
DriverInterface
connect :: (forall m a . MonadIO m => [(String, String)] -> (Database -> m a) -> m a)
MonadIO
defaultdriver :: DriverInterface
Default dummy driver, real drivers should overload this
getOptions
:: Monad m
=> [String]names of options to get
-> [(String, String)]options given
-> m [String]a list of the same length as the first argument with the values of each option. Fails in the given monad if any options is not found.
Can be used by drivers to get option values from the given list of name, value pairs.
getGenerator
:: Monad m
=> [(String, String)]options given
-> m SqlGeneratorAn SQL generator. If there was no generator option, the default is used. Fails if the generator is unknown
Gets an SqlGenerator from the generator option in the given list. Currently available generators: mysql, postgresql, sqlite, default
Produced by Haddock version 0.8