haskelldb-0.12: SQL unwrapper for Haskell.Source codeContentsIndex
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
requiredOptions :: [(String, String)]
}
class Monad m => MonadIO m
defaultdriver :: DriverInterface
getOptions :: Monad m => [String] -> [(String, String)] -> m [String]
getAnnotatedOptions :: Monad m => [(String, String)] -> [(String, String)] -> m [String]
getGenerator :: Monad m => [(String, String)] -> m SqlGenerator
Documentation
data DriverInterface Source
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. requiredOptions lists all required options with a short description, that is printed as help in the DBDirect program.
Constructors
DriverInterface
connect :: forall m a. MonadIO m => [(String, String)] -> (Database -> m a) -> m a
requiredOptions :: [(String, String)]
class Monad m => MonadIO m Source
show/hide Instances
defaultdriver :: DriverInterfaceSource
Default dummy driver, real drivers should overload this
getOptionsSource
:: Monad m
=> [String]options given
-> [(String, 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.
-> m [String]
Can be used by drivers to get option values from the given list of name, value pairs.
getAnnotatedOptionsSource
:: Monad m
=> [(String, String)]options given
-> [(String, 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.
-> m [String]
Can be used by drivers to get option values from the given list of name, value pairs. It is intended for use with the requiredOptions value of the driver.
getGeneratorSource
:: Monad m
=> [(String, String)]An SQL generator. If there was no generator option, the default is used. Fails if the generator is unknown
-> m SqlGenerator
Gets an SqlGenerator from the generator option in the given list. Currently available generators: mysql, postgresql, sqlite, default
Produced by Haddock version 2.6.0