rethinkdb 2.1.0.2 → 2.2.0.0
raw patch · 7 files changed
+49/−14 lines, 7 files
Files
- Database/RethinkDB.hs +4/−3
- Database/RethinkDB/Functions.hs +20/−4
- Database/RethinkDB/Network.hs +15/−3
- Database/RethinkDB/Wire/Query.hs +3/−1
- Database/RethinkDB/Wire/Response.hs +3/−1
- Database/RethinkDB/Wire/Term.hs +3/−1
- rethinkdb.cabal +1/−1
Database/RethinkDB.hs view
@@ -16,6 +16,7 @@ RethinkDBHandle, close, use,+ serverInfo, run, run', runOpts, ReQL, Datum(..),@@ -43,7 +44,7 @@ tableCreate, tableDrop, tableList, indexCreate, indexDrop, indexList, indexRename, indexStatus, indexWait,- changes,+ changes, includeStates, includeInitial, -- * Writing data @@ -97,7 +98,7 @@ setInsert, setUnion, setIntersection, setDifference, (!), (!?), hasFields,- insertAt, spliceAt, deleteAt, changeAt, keys, + insertAt, spliceAt, deleteAt, changeAt, keys, values, literal, remove, Attribute(..), @@ -129,7 +130,7 @@ error, handle, Expr(..), coerceTo, asArray, asString, asNumber, asObject, asBool,- typeOf, info, json, toJSON, uuid,+ typeOf, info, json, toJSON, uuid, uuid5, http, HttpOptions(..), HttpResultFormat(..), HttpMethod(..), PaginationStrategy(..),
Database/RethinkDB/Functions.hs view
@@ -801,6 +801,13 @@ keys :: Expr object => object -> ReQL keys o = op KEYS [o] +-- | The list of values of the given object+--+-- >>> run h $ values ["a" := 1, "b" := 2]+-- [1,2]+values :: Expr object => object -> ReQL+values o = op VALUES [o]+ -- | Match a string to a regular expression. -- -- >>> run' h $ str "foobar" # match "f(.)+[bc](.+)"@@ -1018,6 +1025,10 @@ includeStates :: Attribute a includeStates = "include_states" := P.True +-- | Optional argument for changes+includeInitial :: Attribute a+includeInitial = "include_initial" := P.True+ data Durability = Hard | Soft instance Expr Durability where@@ -1059,7 +1070,12 @@ uuid :: ReQL uuid = op UUID () --- * New in 1.16+-- | Generate a Version 5 UUID+--+-- >>> run h $ uuid5 "foo"+-- "aa32a020-8c2d-5ff1-823b-ad3fa5d067eb"+uuid5 :: Expr name => name -> ReQL+uuid5 name = op UUID [name] -- | Generate numbers starting from 0 --@@ -1115,7 +1131,7 @@ -- | Change a table's configuration -- -- >>> run h $ table "users" # reconfigure 2 1--- {"config_changes":[{"new_val":{"primary_key":"name","write_acks":"majority","durability":"hard","name":"users","shards":...,"id":...,"db":"doctests"},"old_val":...}],"reconfigured":1,"status_changes":[{"new_val":{"status":{"all_replicas_ready":...,"ready_for_outdated_reads":...,"ready_for_writes":...,"ready_for_reads":...},"name":"users","shards":...,"id":...,"db":"doctests"},"old_val":...}]}+-- {"config_changes":[{"new_val":{"primary_key":"name","write_acks":"majority","durability":"hard","name":"users","shards":... reconfigure :: (Expr table, Expr replicas) => ReQL -> replicas -> table -> ReQL reconfigure shards replicas t = op' RECONFIGURE [t] ["shards" := shards, "replicas" := replicas]@@ -1123,7 +1139,7 @@ -- | Rebalance a table's shards -- -- >>> run h $ table "users" # rebalance--- {"rebalanced":1,"status_changes":[{"new_val":{"status":{"all_replicas_ready":...,"ready_for_outdated_reads":...,"ready_for_writes":...,"ready_for_reads":...},"name":"users","shards":...,"id":...,"db":"doctests"},"old_val":...}]}+-- {"rebalanced":1,"status_changes":[{"new_val":{"status":{"all_replicas_ready":...,"ready_for_outdated_reads":... rebalance :: Expr table => table -> ReQL rebalance t = op REBALANCE [t] @@ -1137,6 +1153,6 @@ -- | Get the status of a table -- -- >>> run h $ table "users" # status--- {"status":{"all_replicas_ready":true,"ready_for_outdated_reads":true,"ready_for_writes":true,"ready_for_reads":true},"name":"users","shards":...,"id":...,"db":"doctests"}+-- {"status":{"all_replicas_ready":true,"ready_for_outdated_reads":true,... status :: Expr table => table -> ReQL status t = op STATUS [t]
Database/RethinkDB/Network.hs view
@@ -21,7 +21,8 @@ RethinkDBConnectionError(..), More, noReplyWait,- each+ each,+ serverInfo ) where import Control.Monad (when, forever, forM_)@@ -56,8 +57,8 @@ import qualified Data.HashMap.Strict as HM import Database.RethinkDB.Wire-import Database.RethinkDB.Wire.Response-import Database.RethinkDB.Wire.Query+import Database.RethinkDB.Wire.Response as Response+import Database.RethinkDB.Wire.Query as Query import Database.RethinkDB.Wire.VersionDummy as Protocol import Database.RethinkDB.Types import Database.RethinkDB.Datum@@ -263,6 +264,7 @@ f <!< (Just a) = f a in case type_ of Just SUCCESS_ATOM -> ResponseSingle <!< atom+ Just Response.SERVER_INFO -> ResponseSingle <!< atom Just SUCCESS_PARTIAL -> ResponseBatch (Just $ More False h t) <!< results Just SUCCESS_SEQUENCE -> ResponseBatch Nothing <!< results Just CLIENT_ERROR -> ResponseError $ RethinkDBError ErrorBrokenClient q e bt@@ -469,3 +471,13 @@ else do forM_ batch f each cursor f++-- | Get information about the server+serverInfo :: RethinkDBHandle -> IO Datum+serverInfo h = do+ m <- runQLQuery h (WireQuery $ toDatum [toWire Query.SERVER_INFO]) (Datum Null)+ response <- takeMVar m+ case response of+ ResponseError e -> throwIO e+ ResponseBatch _ _ -> throwIO (RethinkDBError ErrorUnexpectedResponse (Datum Null) "" [])+ ResponseSingle d -> return d
Database/RethinkDB/Wire/Query.hs view
@@ -1,17 +1,19 @@ module Database.RethinkDB.Wire.Query where import Prelude (Maybe(..), Eq, Show) import Database.RethinkDB.Wire-data QueryType = START | CONTINUE | STOP | NOREPLY_WAIT+data QueryType = START | CONTINUE | STOP | NOREPLY_WAIT | SERVER_INFO deriving (Eq, Show) instance WireValue QueryType where toWire START = 1 toWire CONTINUE = 2 toWire STOP = 3 toWire NOREPLY_WAIT = 4+ toWire SERVER_INFO = 5 fromWire 1 = Just START fromWire 2 = Just CONTINUE fromWire 3 = Just STOP fromWire 4 = Just NOREPLY_WAIT+ fromWire 5 = Just SERVER_INFO fromWire _ = Nothing
Database/RethinkDB/Wire/Response.hs view
@@ -1,13 +1,14 @@ module Database.RethinkDB.Wire.Response where import Prelude (Maybe(..), Eq, Show) import Database.RethinkDB.Wire-data ResponseType = SUCCESS_ATOM | SUCCESS_SEQUENCE | SUCCESS_PARTIAL | WAIT_COMPLETE | CLIENT_ERROR | COMPILE_ERROR | RUNTIME_ERROR+data ResponseType = SUCCESS_ATOM | SUCCESS_SEQUENCE | SUCCESS_PARTIAL | WAIT_COMPLETE | SERVER_INFO | CLIENT_ERROR | COMPILE_ERROR | RUNTIME_ERROR deriving (Eq, Show) instance WireValue ResponseType where toWire SUCCESS_ATOM = 1 toWire SUCCESS_SEQUENCE = 2 toWire SUCCESS_PARTIAL = 3 toWire WAIT_COMPLETE = 4+ toWire SERVER_INFO = 5 toWire CLIENT_ERROR = 16 toWire COMPILE_ERROR = 17 toWire RUNTIME_ERROR = 18@@ -15,6 +16,7 @@ fromWire 2 = Just SUCCESS_SEQUENCE fromWire 3 = Just SUCCESS_PARTIAL fromWire 4 = Just WAIT_COMPLETE+ fromWire 5 = Just SERVER_INFO fromWire 16 = Just CLIENT_ERROR fromWire 17 = Just COMPILE_ERROR fromWire 18 = Just RUNTIME_ERROR
Database/RethinkDB/Wire/Term.hs view
@@ -1,7 +1,7 @@ module Database.RethinkDB.Wire.Term where import Prelude (Maybe(..), Eq, Show) import Database.RethinkDB.Wire-data TermType = DATUM | MAKE_ARRAY | MAKE_OBJ | VAR | JAVASCRIPT | UUID | HTTP | ERROR | IMPLICIT_VAR | DB | TABLE | GET | GET_ALL | EQ | NE | LT | LE | GT | GE | NOT | ADD | SUB | MUL | DIV | MOD | FLOOR | CEIL | ROUND | APPEND | PREPEND | DIFFERENCE | SET_INSERT | SET_INTERSECTION | SET_UNION | SET_DIFFERENCE | SLICE | SKIP | LIMIT | OFFSETS_OF | CONTAINS | GET_FIELD | KEYS | OBJECT | HAS_FIELDS | WITH_FIELDS | PLUCK | WITHOUT | MERGE | BETWEEN_DEPRECATED | BETWEEN | REDUCE | MAP | FILTER | CONCAT_MAP | ORDER_BY | DISTINCT | COUNT | IS_EMPTY | UNION | NTH | BRACKET | INNER_JOIN | OUTER_JOIN | EQ_JOIN | ZIP | RANGE | INSERT_AT | DELETE_AT | CHANGE_AT | SPLICE_AT | COERCE_TO | TYPE_OF | UPDATE | DELETE | REPLACE | INSERT | DB_CREATE | DB_DROP | DB_LIST | TABLE_CREATE | TABLE_DROP | TABLE_LIST | CONFIG | STATUS | WAIT | RECONFIGURE | REBALANCE | SYNC | INDEX_CREATE | INDEX_DROP | INDEX_LIST | INDEX_STATUS | INDEX_WAIT | INDEX_RENAME | FUNCALL | BRANCH | OR | AND | FOR_EACH | FUNC | ASC | DESC | INFO | MATCH | UPCASE | DOWNCASE | SAMPLE | DEFAULT | JSON | TO_JSON_STRING | ISO8601 | TO_ISO8601 | EPOCH_TIME | TO_EPOCH_TIME | NOW | IN_TIMEZONE | DURING | DATE | TIME_OF_DAY | TIMEZONE | YEAR | MONTH | DAY | DAY_OF_WEEK | DAY_OF_YEAR | HOURS | MINUTES | SECONDS | TIME | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY | JANUARY | FEBRUARY | MARCH | APRIL | MAY | JUNE | JULY | AUGUST | SEPTEMBER | OCTOBER | NOVEMBER | DECEMBER | LITERAL | GROUP | SUM | AVG | MIN | MAX | SPLIT | UNGROUP | RANDOM | CHANGES | ARGS | BINARY | GEOJSON | TO_GEOJSON | POINT | LINE | POLYGON | DISTANCE | INTERSECTS | INCLUDES | CIRCLE | GET_INTERSECTING | FILL | GET_NEAREST | POLYGON_SUB | MINVAL | MAXVAL+data TermType = DATUM | MAKE_ARRAY | MAKE_OBJ | VAR | JAVASCRIPT | UUID | HTTP | ERROR | IMPLICIT_VAR | DB | TABLE | GET | GET_ALL | EQ | NE | LT | LE | GT | GE | NOT | ADD | SUB | MUL | DIV | MOD | FLOOR | CEIL | ROUND | APPEND | PREPEND | DIFFERENCE | SET_INSERT | SET_INTERSECTION | SET_UNION | SET_DIFFERENCE | SLICE | SKIP | LIMIT | OFFSETS_OF | CONTAINS | GET_FIELD | KEYS | VALUES | OBJECT | HAS_FIELDS | WITH_FIELDS | PLUCK | WITHOUT | MERGE | BETWEEN_DEPRECATED | BETWEEN | REDUCE | MAP | FILTER | CONCAT_MAP | ORDER_BY | DISTINCT | COUNT | IS_EMPTY | UNION | NTH | BRACKET | INNER_JOIN | OUTER_JOIN | EQ_JOIN | ZIP | RANGE | INSERT_AT | DELETE_AT | CHANGE_AT | SPLICE_AT | COERCE_TO | TYPE_OF | UPDATE | DELETE | REPLACE | INSERT | DB_CREATE | DB_DROP | DB_LIST | TABLE_CREATE | TABLE_DROP | TABLE_LIST | CONFIG | STATUS | WAIT | RECONFIGURE | REBALANCE | SYNC | INDEX_CREATE | INDEX_DROP | INDEX_LIST | INDEX_STATUS | INDEX_WAIT | INDEX_RENAME | FUNCALL | BRANCH | OR | AND | FOR_EACH | FUNC | ASC | DESC | INFO | MATCH | UPCASE | DOWNCASE | SAMPLE | DEFAULT | JSON | TO_JSON_STRING | ISO8601 | TO_ISO8601 | EPOCH_TIME | TO_EPOCH_TIME | NOW | IN_TIMEZONE | DURING | DATE | TIME_OF_DAY | TIMEZONE | YEAR | MONTH | DAY | DAY_OF_WEEK | DAY_OF_YEAR | HOURS | MINUTES | SECONDS | TIME | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY | JANUARY | FEBRUARY | MARCH | APRIL | MAY | JUNE | JULY | AUGUST | SEPTEMBER | OCTOBER | NOVEMBER | DECEMBER | LITERAL | GROUP | SUM | AVG | MIN | MAX | SPLIT | UNGROUP | RANDOM | CHANGES | ARGS | BINARY | GEOJSON | TO_GEOJSON | POINT | LINE | POLYGON | DISTANCE | INTERSECTS | INCLUDES | CIRCLE | GET_INTERSECTING | FILL | GET_NEAREST | POLYGON_SUB | MINVAL | MAXVAL deriving (Eq, Show) instance WireValue TermType where toWire DATUM = 1@@ -46,6 +46,7 @@ toWire CONTAINS = 93 toWire GET_FIELD = 31 toWire KEYS = 94+ toWire VALUES = 186 toWire OBJECT = 143 toWire HAS_FIELDS = 32 toWire WITH_FIELDS = 96@@ -221,6 +222,7 @@ fromWire 93 = Just CONTAINS fromWire 31 = Just GET_FIELD fromWire 94 = Just KEYS+ fromWire 186 = Just VALUES fromWire 143 = Just OBJECT fromWire 32 = Just HAS_FIELDS fromWire 96 = Just WITH_FIELDS
rethinkdb.cabal view
@@ -1,5 +1,5 @@ name: rethinkdb-version: 2.1.0.2+version: 2.2.0.0 cabal-version: >=1.8 build-type: Simple license: Apache