Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains all of the basics needed to build a program that interacts with FoundationDB. The documentation throughout this library assumes that you have already read the official developer guide.
Quick start
import qualified FoundationDB as FDB
- Use
withFoundationDB
to get a handle to the database. - Use
runTransaction
and its variants to run a transaction in the IO monad. - Read the docs in FoundationDB.Transaction to learn how to use the
Transaction
monad. runTransaction
throws exceptions.runTransaction'
returns a sum type. Whichever you choose, all errors you can encounter are defined in FoundationDB.Error.- See the tests for basic usage examples.
Synopsis
- currentAPIVersion :: Int
- withFoundationDB :: FoundationDBOptions -> (Database -> IO a) -> IO a
- data FoundationDBOptions = FoundationDBOptions {}
- defaultOptions :: FoundationDBOptions
- data Database
- apiVersionInUse :: Database -> Int
- module FoundationDB.Transaction
- module FoundationDB.Error
- startFoundationDB :: FoundationDBOptions -> IO Database
- stopFoundationDB :: IO ()
Initialization
currentAPIVersion :: Int Source #
Current version of the installed FDB library. For example, returns 630 if you are using FoundationDB client 6.3.x.
withFoundationDB :: FoundationDBOptions -> (Database -> IO a) -> IO a Source #
Handles correctly starting up the network connection to the DB.
Can only be called once per process! Throws an Error
if any part of
setting up the connection to FoundationDB fails.
data FoundationDBOptions Source #
Options set at the connection level for FoundationDB.
FoundationDBOptions | |
|
Instances
Eq FoundationDBOptions Source # | |
Defined in FoundationDB.Internal.Database (==) :: FoundationDBOptions -> FoundationDBOptions -> Bool # (/=) :: FoundationDBOptions -> FoundationDBOptions -> Bool # | |
Ord FoundationDBOptions Source # | |
Defined in FoundationDB.Internal.Database compare :: FoundationDBOptions -> FoundationDBOptions -> Ordering # (<) :: FoundationDBOptions -> FoundationDBOptions -> Bool # (<=) :: FoundationDBOptions -> FoundationDBOptions -> Bool # (>) :: FoundationDBOptions -> FoundationDBOptions -> Bool # (>=) :: FoundationDBOptions -> FoundationDBOptions -> Bool # max :: FoundationDBOptions -> FoundationDBOptions -> FoundationDBOptions # min :: FoundationDBOptions -> FoundationDBOptions -> FoundationDBOptions # | |
Show FoundationDBOptions Source # | |
Defined in FoundationDB.Internal.Database showsPrec :: Int -> FoundationDBOptions -> ShowS # show :: FoundationDBOptions -> String # showList :: [FoundationDBOptions] -> ShowS # |
defaultOptions :: FoundationDBOptions Source #
Uses the current API version, the default cluster file location, and no additional options.
apiVersionInUse :: Database -> Int Source #
Returns the API version that was specified in the apiVersion
field when
the FDB client was initialized.
Transactions
module FoundationDB.Transaction
Errors
module FoundationDB.Error
Helpers for ghci
startFoundationDB :: FoundationDBOptions -> IO Database Source #
Starts up FoundationDB. You must call stopFoundationDB
before your
program terminates. It's recommended that you use withFoundationDB
instead,
since it handles cleanup. This function is only intended to be used in GHCi.
Can only be called once per process! Throws an Error
if any part of
setting up the connection FoundationDB fails.
stopFoundationDB :: IO () Source #
Stops FoundationDB. For use with startFoundationDB
.