packages feed

rethinkdb 2.0.0.0 → 2.1.0.0

raw patch · 9 files changed

+76/−20 lines, 9 files

Files

Database/RethinkDB.hs view
@@ -113,6 +113,7 @@   (==), (/=), (>), (>=), (<), (<=),   not,   random, randomTo, randomFromTo,+  floor, ceil, round,      -- * Dates and times   
Database/RethinkDB/Driver.hs view
@@ -49,16 +49,22 @@  -- | Per-query settings data RunFlag =-  UseOutdated |+  UseOutdated | -- ^ Deprecated. Use `ReadMode Outdated` instead+  ReadMode ReadMode |   NoReply |   Durability Durability |   Profile |   ArrayLimit Int +data ReadMode = Majority | Single | Outdated+ data Durability = Hard | Soft  renderOption :: RunFlag -> (Text, Datum)-renderOption UseOutdated = "user_outdated" .= True+renderOption UseOutdated = "read_mode" .= ("outdated" :: String)+renderOption (ReadMode Majority) = "read_mode" .= ("majority" :: String)+renderOption (ReadMode Single) = "read_mode" .= ("single" :: String)+renderOption (ReadMode Outdated) = "read_mode" .= ("outdated" :: String) renderOption NoReply = "noreply" .= True renderOption (Durability Soft) = "durability" .= ("soft" :: String) renderOption (Durability Hard) = "durability" .= ("hard" :: String)
Database/RethinkDB/Functions.hs view
@@ -39,7 +39,7 @@ -- >>> import qualified Database.RethinkDB as R -- >>> :set -XOverloadedStrings -- >>> default (Datum, ReQL, String, Int, Double)--- >>> h <- doctestConnect +-- >>> h <- doctestConnect  -- $init_doctests -- >>> try' $ run' h $ dbCreate "doctests"@@ -441,6 +441,27 @@ max :: Expr s => s -> ReQL max s = op MAX [s] +-- | Floor rounds number to interger below+--+-- >>> run h $ R.floor 2.9+-- 2+floor :: Expr s => s -> ReQL+floor s = op FLOOR [s]++-- | Ceil rounds number to integer above+--+-- >>> run h $ R.ceil 2.1+-- 3+ceil :: Expr s => s -> ReQL+ceil s = op CEIL [s]++-- | Round rounds number to nearest integer+--+-- >>> run h $ R.round 2.5+-- 3+round :: Expr s => s -> ReQL+round s = op ROUND [s]+ -- | Value that maximizes the function argmax :: (Expr s, Expr a) => (ReQL -> a) -> s -> ReQL argmax f s = op MAX (s, expr . f)@@ -647,7 +668,7 @@ -- | Convert a value to a string -- -- >>> run h $ asString $ ["a" := 1, "b" := 2]--- "{\n\t\"a\":\t1,\n\t\"b\":\t2\n}"+-- "{\"a\":1,\"b\":2}" asString :: Expr x => x -> ReQL asString = coerceTo "STRING" @@ -705,7 +726,7 @@  -- | The different of two lists ----- >>> run h $ [1,2,3,4,5] # difference [2,5] +-- >>> run h $ [1,2,3,4,5] # difference [2,5] -- [1,3,4] difference :: (Expr a, Expr b) => a -> b -> ReQL difference a b = op DIFFERENCE (b, a)@@ -953,7 +974,7 @@ http :: Expr url => url -> HttpOptions -> ReQL http url opts = op' HTTP [url] $ render opts   where-    render ho = +    render ho =       let         go :: Expr x => (HttpOptions -> Maybe x) -> Text -> [Attribute Static]         go f s = maybe [] (\x -> [s := x]) (f ho)@@ -1010,7 +1031,7 @@ -- | Optional argument for non-atomic writes -- -- >>> run' h $ table "users" # get "sabrina" # update (merge ["lucky_number" := random])--- *** Exception: RethinkDB: Runtime error: "Could not prove function deterministic.  Maybe you want to use the non_atomic flag?"+-- *** Exception: RethinkDB: Runtime error: "Could not prove argument deterministic.  Maybe you want to use the non_atomic flag?" --   in --     {- HERE -} --     update(@@ -1064,7 +1085,7 @@ -- | Wait for tables to be ready -- -- >>> run h $ table "users" # wait--- {"ready":1,"status_changes":[{"new_val":{"status":{"all_replicas_ready":true,"ready_for_outdated_reads":true,"ready_for_writes":true,"ready_for_reads":true},"name":"users","shards":...,"id":...,"db":"doctests"},"old_val":...}]}+-- {"ready":1} wait :: Expr table => table -> ReQL wait t = op WAIT [t] 
Database/RethinkDB/Network.hs view
@@ -28,8 +28,8 @@ import Data.Typeable (Typeable) import Network (HostName) import Network.Socket (-  socket, Family(AF_INET, AF_INET6), SocketType(Stream), sClose, setSocketOption, SocketOption(NoDelay),-  Socket, AddrInfo(AddrInfo, addrAddress, addrFamily))+  socket, Family(AF_INET, AF_INET6), SocketType(Stream), sClose, setSocketOption,+  SocketOption(NoDelay, KeepAlive), Socket, AddrInfo(AddrInfo, addrAddress, addrFamily)) import qualified Network.Socket as Socket import Network.BSD (getProtocolNumber) import Network.Socket.ByteString.Lazy (sendAll)@@ -122,6 +122,7 @@   bracketOnError (socket addrF Stream proto) sClose $ \sock -> do     Socket.connect sock (addrAddress addrI)     setSocketOption sock NoDelay 1+    setSocketOption sock KeepAlive 1     return sock  -- | Create a new connection to the database server
Database/RethinkDB/NoClash.hs view
@@ -11,4 +11,5 @@   sum, map, mod, concatMap, (&&),   not, (||), (/=), (<), (<=), (>), (>=), error, (==), filter,   max, min,-  zip, zipWith)+  zip, zipWith,+  floor, ceil, round)
Database/RethinkDB/ReQL.hs view
@@ -108,7 +108,7 @@   queryToken :: Int64,   queryDefaultDatabase :: Database,   queryVarIndex :: Int,-  queryUseOutdated :: Maybe Bool+  queryReadMode :: Maybe String   }  instance Default QuerySettings where@@ -438,7 +438,7 @@ instance Expr Table where   expr (Table mdb name _) = withQuerySettings $ \QuerySettings {..} ->     op' TABLE (fromMaybe queryDefaultDatabase mdb, name) $ catMaybes [-      fmap ("use_outdated" :=) queryUseOutdated ]+      fmap ("read_mode" :=) queryReadMode ]  instance Expr Database where   expr (Database name) = op DB [name]
Database/RethinkDB/Wire/Response.hs view
@@ -21,6 +21,26 @@   fromWire _ = Nothing  +data ErrorType = INTERNAL | RESOURCE_LIMIT | QUERY_LOGIC | NON_EXISTENCE | OP_FAILED | OP_INDETERMINATE | USER+  deriving (Eq, Show)+instance WireValue ErrorType where+  toWire INTERNAL = 1000000+  toWire RESOURCE_LIMIT = 2000000+  toWire QUERY_LOGIC = 3000000+  toWire NON_EXISTENCE = 3100000+  toWire OP_FAILED = 4100000+  toWire OP_INDETERMINATE = 4200000+  toWire USER = 5000000+  fromWire 1000000 = Just INTERNAL+  fromWire 2000000 = Just RESOURCE_LIMIT+  fromWire 3000000 = Just QUERY_LOGIC+  fromWire 3100000 = Just NON_EXISTENCE+  fromWire 4100000 = Just OP_FAILED+  fromWire 4200000 = Just OP_INDETERMINATE+  fromWire 5000000 = Just USER+  fromWire _ = Nothing++ data ResponseNote = SEQUENCE_FEED | ATOM_FEED | ORDER_BY_LIMIT_FEED | UNIONED_FEED | INCLUDES_STATES   deriving (Eq, Show) instance WireValue ResponseNote where
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 | 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 | 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@@ -29,6 +29,9 @@   toWire MUL = 26   toWire DIV = 27   toWire MOD = 28+  toWire FLOOR = 183+  toWire CEIL = 184+  toWire ROUND = 185   toWire APPEND = 29   toWire PREPEND = 80   toWire DIFFERENCE = 95@@ -201,6 +204,9 @@   fromWire 26 = Just MUL   fromWire 27 = Just DIV   fromWire 28 = Just MOD+  fromWire 183 = Just FLOOR+  fromWire 184 = Just CEIL+  fromWire 185 = Just ROUND   fromWire 29 = Just APPEND   fromWire 80 = Just PREPEND   fromWire 95 = Just DIFFERENCE
rethinkdb.cabal view
@@ -1,5 +1,5 @@ name: rethinkdb-version: 2.0.0.0+version: 2.1.0.0 cabal-version: >=1.8 build-type: Simple license: Apache@@ -15,7 +15,7 @@ source-repository head     type: git     location: https://github.com/atnnn/haskell-rethinkdb- + flag dev     default: False     manual: True@@ -37,12 +37,13 @@         binary >=0.5 && <0.8,         scientific ==0.3.*,         base64-bytestring ==1.0.*-     +     if flag(dev)         other-modules:             Debug         exposed: True         buildable: True+        -- ghc-prof-options: -fprof-auto     exposed-modules:         Database.RethinkDB         Database.RethinkDB.NoClash@@ -66,7 +67,6 @@     exposed: True     buildable: True     ghc-options: -Wall-    ghc-prof-options: -fprof-auto  test-suite doctests     build-depends:@@ -92,7 +92,7 @@     ghc-prof-options: "-with-rtsopts=-p -s -h -i0.1 -N"  executable proto2hs-  if flag(dev)-    buildable: True+  if !flag(dev)+    buildable: False   main-is: proto2hs.hs   build-depends: base, text, attoparsec