rethinkdb-1.15.1.0: A driver for RethinkDB 1.15

Safe HaskellNone

Database.RethinkDB.Network

Synopsis

Documentation

data RethinkDBHandle

A connection to the database server

Constructors

RethinkDBHandle 

Fields

rdbHandle :: Handle
 
rdbWriteLock :: MVar (Maybe SomeException)
 
rdbToken :: IORef Token

The next token to use

rdbDatabase :: Database

The default database

rdbWait :: IORef (Map Token (Chan Response, Term, IO ()))
 
rdbThread :: ThreadId
 

connect :: HostName -> Integer -> Maybe String -> IO RethinkDBHandle

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 ()

Close an open connection

use :: Database -> RethinkDBHandle -> RethinkDBHandle

Set the default database

The new handle is an alias for the old one. Calling close on either one will close both.

data Cursor a

Instances

next :: Cursor a -> IO (Maybe a)

Get the next value from a cursor

nextBatch :: Cursor a -> IO [a]

Get the next batch from a cursor

collect :: Cursor a -> IO [a]

A lazy stream of all the elements in the cursor

collect' :: Cursor a -> IO [a]

A strict version of collect

data Response

The response to a query

data More

noReplyWait :: RethinkDBHandle -> IO ()

Wait for NoReply queries to complete on the server

>>> () <- runOpts h [NoReply] $ table "users" # get "bob" # update (\row -> merge row ["occupation" := "teacher"])
>>> noReplyWait h

each :: Cursor a -> (a -> IO b) -> IO ()