Safe Haskell | None |
---|
- data RethinkDBHandle = RethinkDBHandle {
- rdbHandle :: Handle
- rdbWriteLock :: MVar (Maybe SomeException)
- rdbToken :: IORef Token
- rdbDatabase :: Database
- rdbWait :: IORef (Map Token (Chan Response, Term, IO ()))
- rdbThread :: ThreadId
- connect :: HostName -> Integer -> Maybe String -> IO RethinkDBHandle
- close :: RethinkDBHandle -> IO ()
- use :: Database -> RethinkDBHandle -> RethinkDBHandle
- runQLQuery :: RethinkDBHandle -> WireQuery -> Term -> IO (MVar Response)
- data Cursor a = Cursor {
- cursorMBox :: MVar Response
- cursorBuffer :: MVar (Either RethinkDBError ([Datum], Bool))
- cursorMap :: Datum -> IO a
- makeCursor :: MVar Response -> IO (Cursor Datum)
- next :: Cursor a -> IO (Maybe a)
- nextBatch :: Cursor a -> IO [a]
- collect :: Cursor a -> IO [a]
- collect' :: Cursor a -> IO [a]
- nextResponse :: Response -> IO ()
- data Response
- = ResponseError RethinkDBError
- | ResponseSingle Datum
- | ResponseBatch (Maybe More) [Datum]
- data ErrorCode
- data RethinkDBError = RethinkDBError {
- errorCode :: ErrorCode
- errorTerm :: Term
- errorMessage :: String
- errorBacktrace :: Backtrace
- data RethinkDBConnectionError = RethinkDBConnectionError String
- data More
- noReplyWait :: RethinkDBHandle -> IO ()
- each :: Cursor a -> (a -> IO b) -> IO ()
Documentation
data RethinkDBHandle Source
A connection to the database server
RethinkDBHandle | |
|
Show RethinkDBHandle |
connect :: HostName -> Integer -> Maybe String -> IO RethinkDBHandleSource
Create a new connection to the database server
Example: connect using the default port with no passphrase
>>>
h <- connect "localhost" 28015 Nothing
close :: RethinkDBHandle -> IO ()Source
Close an open connection
use :: Database -> RethinkDBHandle -> RethinkDBHandleSource
Set the default database
The new handle is an alias for the old one. Calling close on either one will close both.
runQLQuery :: RethinkDBHandle -> WireQuery -> Term -> IO (MVar Response)Source
Cursor | |
|
makeCursor :: MVar Response -> IO (Cursor Datum)Source
nextResponse :: Response -> IO ()Source
The response to a query
Show ErrorCode |
data RethinkDBError Source
RethinkDBError | |
|
Show RethinkDBError | |
Typeable RethinkDBError | |
Exception RethinkDBError |
data RethinkDBConnectionError Source
RethinkDBConnectionError String |
Show RethinkDBConnectionError | |
Typeable RethinkDBConnectionError | |
Exception RethinkDBConnectionError |
noReplyWait :: RethinkDBHandle -> IO ()Source
Wait for NoReply queries to complete on the server
>>>
() <- runOpts h [NoReply] $ table "users" # get "bob" # update (\row -> merge row ["occupation" := "teacher"])
>>>
noReplyWait h