rethinkdb 2.2.0.6 → 2.2.0.7
raw patch · 6 files changed
+30/−19 lines, 6 filesdep ~aeson
Dependency ranges changed: aeson
Files
- Database/RethinkDB.hs +1/−1
- Database/RethinkDB/Driver.hs +12/−2
- Database/RethinkDB/Functions.hs +7/−10
- Database/RethinkDB/Network.hs +4/−4
- Database/RethinkDB/ReQL.hs +4/−0
- rethinkdb.cabal +2/−2
Database/RethinkDB.hs view
@@ -74,7 +74,7 @@ map, zipWith, zipWithN, withFields, concatMap, orderBy, asc, desc,- skip, limit, slice,+ skip, limit, slice, nth, indexesOf, isEmpty, union, sample, -- * Aggregation
Database/RethinkDB/Driver.hs view
@@ -6,6 +6,8 @@ Result(..), runOpts, RunFlag(..),+ Durability(..),+ durability, WriteResponse(..), Change(..) ) where@@ -60,6 +62,14 @@ data Durability = Hard | Soft +instance Expr Durability where+ expr Hard = "hard"+ expr Soft = "soft"++-- | Optional argument for soft durability writes+durability :: Durability -> Attribute a+durability d = "durability" := d+ renderOption :: RunFlag -> (Text, Datum) renderOption UseOutdated = "read_mode" .= ("outdated" :: String) renderOption (ReadMode Majority) = "read_mode" .= ("majority" :: String)@@ -115,7 +125,7 @@ instance FromDatum a => Result (Cursor a) where convertResult r = do- c <- makeCursor r + c <- makeCursor r return c { cursorMap = unsafeFromDatum } unsafeFromDatum :: FromDatum a => Datum -> IO a@@ -144,7 +154,7 @@ Error a -> return $ Left $ RethinkDBError ErrorUnexpectedResponse (Datum Null) a [] instance FromDatum a => Result (Maybe a) where- convertResult v = do + convertResult v = do ed <- convertResult v case ed of Left _ -> return Nothing
Database/RethinkDB/Functions.hs view
@@ -350,6 +350,13 @@ slice :: (Expr a, Expr b, Expr c) => a -> b -> c -> ReQL slice n m s = op SLICE (s, n, m) +-- | Get nth element of a sequence+--+-- >>> run h $ nth 2 [1, 2, 3, 4, 5]+-- 3+nth :: (Expr a, Expr seq) => a -> seq -> ReQL+nth a s = op NTH (s, a)+ -- | Reduce a sequence to a single value -- -- >>> run h $ reduce0 (+) 0 [1, 2, 3]@@ -1028,16 +1035,6 @@ -- | Optional argument for changes includeInitial :: Attribute a includeInitial = "include_initial" := P.True--data Durability = Hard | Soft--instance Expr Durability where- expr Hard = "hard"- expr Soft = "soft"---- | Optional argument for soft durability writes-durability :: Durability -> Attribute a-durability d = "durability" := d -- | Optional argument for non-atomic writes --
Database/RethinkDB/Network.hs view
@@ -29,7 +29,7 @@ import Data.Typeable (Typeable) import Network (HostName) import Network.Socket (- socket, Family(AF_INET, AF_INET6), SocketType(Stream), sClose, setSocketOption,+ socket, Family(AF_INET, AF_INET6), SocketType(Stream), setSocketOption, SocketOption(NoDelay, KeepAlive), Socket, AddrInfo(AddrInfo, addrAddress, addrFamily)) import qualified Network.Socket as Socket import Network.BSD (getProtocolNumber)@@ -120,7 +120,7 @@ let addrI = head h let addrF = getAddrFamily addrI proto <- getProtocolNumber "tcp"- bracketOnError (socket addrF Stream proto) sClose $ \sock -> do+ bracketOnError (socket addrF Stream proto) Socket.close $ \sock -> do Socket.connect sock (addrAddress addrI) setSocketOption sock NoDelay 1 setSocketOption sock KeepAlive 1@@ -333,7 +333,7 @@ tid <- myThreadId let h = h' tid let handler e@SomeException{} = do- sClose $ rdbSocket h+ Socket.close $ rdbSocket h modifyMVar (rdbWriteLock h) $ \_ -> return (Just e, ()) writeIORef (rdbWait h) M.empty flip catch handler $ forever $ readSingleResponse h@@ -384,7 +384,7 @@ close h@RethinkDBHandle{ rdbSocket, rdbThread } = do noReplyWait h killThread rdbThread- sClose rdbSocket+ Socket.close rdbSocket closeToken :: RethinkDBHandle -> Token -> IO () closeToken h tok = do
Database/RethinkDB/ReQL.hs view
@@ -37,7 +37,11 @@ ) where import qualified Data.Aeson as J+#if MIN_VERSION_aeson(1,0,0)+import qualified Data.Aeson.Text as J+#else import qualified Data.Aeson.Encode as J+#endif import qualified Data.Text.Lazy as LT import qualified Data.Text.Lazy.Builder as LT import Data.Aeson (Value)
rethinkdb.cabal view
@@ -1,5 +1,5 @@ name: rethinkdb-version: 2.2.0.6+version: 2.2.0.7 cabal-version: >=1.8 build-type: Simple license: Apache@@ -31,7 +31,7 @@ base >=4 && <4.10, unordered-containers ==0.2.*, text >=0.11 && <1.3,- aeson >=0.7 && <0.12,+ aeson >=0.7 && <1.1, bytestring ==0.10.*, containers ==0.5.*, data-default >=0.5 && <0.8,