Copyright | Anders Hockersten (c), [email protected] |
---|---|
License | BSD-style |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
Database.HaskellDB.DriverAPI
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.
- data DriverInterface = DriverInterface {}
- 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 | |
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Minimal complete definition
defaultdriver :: DriverInterface Source
Default dummy driver, real drivers should overload this
Arguments
:: 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.
Arguments
:: Monad m | |
=> [(String, String)] | names and descriptions 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.
It is intended for use with the requiredOptions
value of the driver.
Arguments
:: Monad m | |
=> [(String, String)] | options given |
-> m SqlGenerator | An 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"