rethinkdb- A driver for RethinkDB 2.0

Safe HaskellNone




termToMapReduce :: (ReQL -> ReQL) -> State QuerySettings (ReQL -> ReQL) Source

Takes a function that takes a sequence as an argument, and returns a function that only uses that sequence once, by merging the map and reduce operations. This is used by groupBy.

sameVar :: Int -> [Term] -> Bool Source

Compares the two representations of a variable

notConst :: Chain -> Bool Source

notNone checks that it is a map/reduce and not a constant

wrap :: Term -> ReQL Source

Helper function for casting up from Term into ReQL

toFun1 :: Term -> ReQL -> ReQL Source

Build a single argument function from a constant ReQL expression

toFun2 :: Term -> ReQL -> ReQL -> ReQL Source

Build a two argument function from a constant ReQL expression

data MRF Source

Represents a map/reduce operation split into its map and reduce parts



data Chain Source

A Chain of ReQL expressions that might be transformed into a map/reduce operation


None ReQL

A constant, not really a map/reduce operation

Map [Map]

Just a map

MapReduceChain [Map] Reduce

map/reduce operations represented as parts

MapReduce MRF

A rewritten map/reduce

SingletonArray ReQL

Special cases for reduce with base

AddBase ReQL Chain 

data Map Source

A built-in map operation

data MapFun Source


MapFun (ReQL -> ReQL) 
ConcatMapFun (ReQL -> ReQL) 

applyChain :: Chain -> ReQL -> ReQL Source

Convert a Chain back into a ReQL function

applyMRF :: MRF -> ReQL -> ReQL Source

Convert an MRF into a ReQL function

thenMRF :: [Map] -> MRF -> MRF Source

toMapReduce :: Int -> Term -> Chain Source

Rewrites the term in the second argument to merge all uses of the variable whose id is given in the first argument.

mrChain :: TermType -> Chain -> [Term] -> [TermAttribute] -> Maybe Chain Source

Chain a ReQL command onto a MapReduce operation

mapMRF :: TermType -> [Term] -> [TermAttribute] -> Maybe MapFun Source

Convert some builtin operations into a map

reduceMRF :: TermType -> [Term] -> [TermAttribute] -> Maybe MRF Source

Convert some of the built-in operations into a map/reduce

TODO: these have not been tested

baseAttrToOptArg :: TermAttribute -> OptArg Source

Convert from one representation to the other

noRecurse :: OptArg Source

This undocumented optional argument circumvents stream polymorphism on some operations

rewrite1 :: TermType -> [Chain] -> [(Text, Chain)] -> MRF Source

Rewrite a command into a map/reduce.

This is a special case for when only one of the arguments is itself a map/reduce

rewritex :: TermType -> [Chain] -> [(Key, Chain)] -> MRF Source

Rewrite a command that combines the result of multiple map/reduce operations into a single map/reduce operation

extract :: Maybe Int -> TermType -> [Chain] -> [(Key, Chain)] -> ([ReQL] -> ReQL, [MRF]) Source

Extract the inner map/reduce objects, also returning a function which, given the result of all the map/reduce operations, returns the result of the given command