rethinkdb-1.8.0.0: RethinkDB driver for Haskell

Safe HaskellNone

Database.RethinkDB.Functions

Contents

Description

Functions from the ReQL (RethinkDB Query Language)

Synopsis

Documentation

(+) :: (Expr a, Expr b) => a -> b -> ReQLSource

Arithmetic Operator

mod :: (Expr a, Expr b) => a -> b -> ReQLSource

Arithmetic Operator

(/) :: (Expr a, Expr b) => a -> b -> ReQLSource

Arithmetic Operator

(*) :: (Expr a, Expr b) => a -> b -> ReQLSource

Arithmetic Operator

(-) :: (Expr a, Expr b) => a -> b -> ReQLSource

Arithmetic Operator

(||) :: (Expr a, Expr b) => a -> b -> ReQLSource

Boolean operator

(&&) :: (Expr a, Expr b) => a -> b -> ReQLSource

Boolean operator

(==) :: (Expr a, Expr b) => a -> b -> ReQLSource

Comparison operator

(!=) :: (Expr a, Expr b) => a -> b -> ReQLSource

Comparison operator

(>) :: (Expr a, Expr b) => a -> b -> ReQLSource

Comparison operator

(<=) :: (Expr a, Expr b) => a -> b -> ReQLSource

Comparison operator

(<) :: (Expr a, Expr b) => a -> b -> ReQLSource

Comparison operator

(>=) :: (Expr a, Expr b) => a -> b -> ReQLSource

Comparison operator

not :: Expr a => a -> ReQLSource

Negation

Lists and Streams

length :: Expr a => a -> ReQLSource

The size of a sequence or an array Called count in the official drivers

(++) :: (Expr a, Expr b) => a -> b -> ReQLSource

Join two sequences. Called union in the official drivers

map :: (Expr a, Expr b) => (ReQL -> b) -> a -> ReQLSource

Map a function over a sequence

filter :: (Expr predicate, Expr seq) => predicate -> seq -> ReQLSource

Filter a sequence given a predicate

between :: (Expr left, Expr right, Expr seq) => Key -> left -> right -> seq -> ReQLSource

Query all the documents whose value for the given index is in a given range

append :: (Expr a, Expr b) => a -> b -> ReQLSource

Append a datum to a sequence

concatMap :: (Expr a, Expr b) => (ReQL -> b) -> a -> ReQLSource

Map a function of a sequence and concat the results

innerJoin :: (Expr a, Expr b, Expr c) => (ReQL -> ReQL -> c) -> a -> b -> ReQLSource

SQL-like join of two sequences. Returns each pair of rows that satisfy the 2-ary predicate.

outerJoin :: (Expr a, Expr b, Expr c) => (ReQL -> ReQL -> c) -> a -> b -> ReQLSource

SQL-like join of two sequences. Returns each pair of rows that satisfy the 2-ary predicate.

eqJoin :: (Expr a, Expr b) => Key -> a -> Key -> b -> ReQLSource

An efficient iner_join that uses a key for the first table and an index for the left table.

drop :: (Expr a, Expr b) => a -> b -> ReQLSource

Drop elements from the head of a sequence Called skip in the official drivers

take :: (Expr a, Expr b) => a -> b -> ReQLSource

Limit the size of a sequence Called limit in the official drivers

slice :: (Expr a, Expr b, Expr c) => a -> b -> c -> ReQLSource

Cut out part of a sequence

(!!) :: Expr a => a -> ReQL -> ReQLSource

Get the nth value of a sequence or array

reduce :: (Expr base, Expr seq, Expr a) => (ReQL -> ReQL -> a) -> base -> seq -> ReQLSource

Reduce a sequence to a single value

reduce1 :: (Expr a, Expr s) => (ReQL -> ReQL -> a) -> s -> ReQLSource

Reduce a non-empty sequence to a single value

distinct :: Expr s => s -> ReQLSource

Filter out identical elements of the sequence

forEach :: (Expr s, Expr a) => s -> (ReQL -> a) -> ReQLSource

Like map but for write queries

mergeRightLeft :: Expr a => a -> ReQLSource

Merge the left and right attributes of the objects in a sequence Called zip in the official drivers

data Order Source

Oredering specification for orderBy

Constructors

Asc 

Fields

orderAttr :: Key
 
Desc 

Fields

orderAttr :: Key
 

orderBy :: Expr s => [Order] -> s -> ReQLSource

Order a sequence by the given keys

groupBy :: (Expr group, Expr reduction, Expr seq) => (ReQL -> group) -> (ReQL -> reduction) -> seq -> ReQLSource

Turn a grouping function and a reduction function into a grouped map reduce operation

sum :: Expr s => s -> ReQLSource

The sum of a sequence

avg :: Expr s => s -> ReQLSource

The average of a sequence

Accessors

(!) :: Expr s => s -> ReQL -> ReQLSource

Get a single field form an object

pluck :: Expr o => [ReQL] -> o -> ReQLSource

Keep only the given attributes

without :: Expr o => [ReQL] -> o -> ReQLSource

Remove the given attributes from an object

member :: Expr o => [ReQL] -> o -> ReQLSource

Test if an object contains the given attribute Called contains in the official drivers

merge :: (Expr a, Expr b) => a -> b -> ReQLSource

Merge two objects together

class Javascript r whereSource

Create a javascript expression

Methods

js :: String -> rSource

if' :: (Expr a, Expr b, Expr c) => a -> b -> c -> ReQLSource

Called branch in the official drivers

error :: Expr s => s -> ReQLSource

db :: Text -> DatabaseSource

Create a Database reference

dbCreate :: String -> ReQLSource

Create a database on the server

dbDrop :: Database -> ReQLSource

Drop a database

dbList :: ReQLSource

List the databases on the server

indexCreate :: Expr fun => String -> fun -> Table -> ReQLSource

Create an index on the table from the given function

indexDrop :: Key -> Table -> ReQLSource

Drop an index

indexList :: Table -> ReQLSource

List the indexes on the table

getAll :: Expr value => Key -> [value] -> Table -> ReQLSource

Retreive documents by their indexed value

table :: Text -> TableSource

Create a simple table refence with no associated database

tableCreate :: Table -> TableCreateOptions -> ReQLSource

Create a table on the server

tableDrop :: Table -> ReQLSource

Drop a table

tableList :: Database -> ReQLSource

List the tables in a database

get :: (Expr s, Expr k) => k -> s -> ReQLSource

Get a document by primary key

insert :: (Expr table, Expr object) => object -> table -> ReQLSource

Insert a document or a list of documents into a table

upsert :: (Expr table, Expr object) => object -> table -> ReQLSource

Like insert, but update existing documents with the same primary key

update :: Expr selection => (ReQL -> ReQL) -> selection -> ReQLSource

Add to or modify the contents of a document

replace :: Expr selection => (ReQL -> ReQL) -> selection -> ReQLSource

Replace a document with another

delete :: Expr selection => selection -> ReQLSource

Delete the documents

coerceTo :: Expr x => ReQL -> x -> ReQLSource

Convert a value to a different type

asArray :: Expr x => x -> ReQLSource

Convert a value to a different type

asBool :: Expr x => x -> ReQLSource

Convert a value to a different type

asObject :: Expr x => x -> ReQLSource

Convert a value to a different type

asNumber :: Expr x => x -> ReQLSource

Convert a value to a different type

asString :: Expr x => x -> ReQLSource

Convert a value to a different type

withFields :: (Expr paths, Expr seq) => [paths] -> seq -> ReQLSource

Like hasFields followed by pluck

indexesOf :: (Expr fun, Expr seq) => fun -> seq -> ReQLSource

The position in the sequence of the elements that match the predicate

isEmpty :: Expr seq => seq -> ReQLSource

Test if a sequence is empty

sample :: (Expr n, Expr seq) => n -> seq -> ReQLSource

Select a given number of elements from a sequence with uniform random distribution

prepend :: (Expr datum, Expr array) => datum -> array -> ReQLSource

Prepend an element to an array

(\\) :: (Expr a, Expr b) => a -> b -> ReQLSource

Called difference in the official drivers

setInsert :: (Expr datum, Expr array) => datum -> array -> ReQLSource

Insert a datum into an array if it is not yet present

setUnion :: (Expr a, Expr b) => a -> b -> ReQLSource

The union of two sets

setIntersection :: (Expr a, Expr b) => a -> b -> ReQLSource

The intersection of two sets

setDifference :: (Expr set, Expr remove) => remove -> set -> ReQLSource

The difference of two sets

hasFields :: (Expr obj, Expr paths) => paths -> obj -> ReQLSource

Test if an object has the given fields

insertAt :: (Expr n, Expr datum, Expr array) => n -> datum -> array -> ReQLSource

Insert a datum at the given position in an array

spliceAt :: (Expr n, Expr replace, Expr array) => n -> replace -> array -> ReQLSource

Splice an array at a given position inside another array

deleteAt :: (Expr n, Expr array) => n -> array -> ReQLSource

Delete an element from an array

changeAt :: (Expr n, Expr datum, Expr array) => n -> datum -> array -> ReQLSource

Change an element in an array

keys :: Expr obj => obj -> ReQLSource

The list of keys of the given object

(=~) :: (Expr string, Expr regex) => string -> regex -> ReQLSource

Match a string to a regulr expression Called match in the official drivers

apply :: (Expr fun, Expr arg) => fun -> [arg] -> ReQLSource

Apply a function to a list of arguments Called do in the official drivers

handle :: (Expr handler, Expr reql) => handler -> reql -> ReQLSource

Catch some expections inside the query. Called default in the official drivers

typeOf :: Expr a => a -> ReQLSource

A string representing the type of an expression

info :: Expr a => a -> ReQLSource

Get information on a given expression. Useful for tables and databases.

json :: Expr string => string -> ReQLSource

Parse a json string into an object

(#) :: (Expr a, Expr b, Expr c) => (ReQL -> a) -> (ReQL -> b) -> c -> ReQLSource

Flipped function composition

(.) :: (Expr a, Expr b, Expr c) => (ReQL -> b) -> (ReQL -> a) -> c -> ReQLSource

Specialised function composition