rocksdb-query 0.1.2 → 0.1.3
raw patch · 3 files changed
+12/−25 lines, 3 files
Files
- CHANGELOG.md +4/−0
- rocksdb-query.cabal +2/−2
- src/Database/RocksDB/Query.hs +6/−23
CHANGELOG.md view
@@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.1.3+### Changed+- Reduce documentation verbosity and correct wording.+ ## 0.1.2 ### Added - Documentation for all functions.
rocksdb-query.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: dd06f47b01071602c32222c3f44072c5ec442ff18584fb8ab966326128b16053+-- hash: a8f0688412290c91f53e55825ee00bdf9cc1c801c9eba75a20153791ba7fc6c5 name: rocksdb-query-version: 0.1.2+version: 0.1.3 synopsis: RocksDB database querying library for Haskell description: Please see the README on GitHub at <https://github.com/xenog/rocksdb-query#readme> category: Database
src/Database/RocksDB/Query.hs view
@@ -54,27 +54,8 @@ -- | Use the passed key to filter all the elements whose key prefix match it. -- Use a sum type for keys that allows to set a version of the key that has a--- shorter length when serialized..+-- shorter length when serialized. ----- > #!/usr/bin/env stack--- > {- stack--- > --resolver lts-12.9--- > --install-ghc--- > runghc--- > --package base--- > --package cereal--- > --package conduit--- > --package rocksdb-haskell-1.0.1--- > --package rocksdb-query-0.1.2--- > ----- > -hide-all-packages--- > -}--- > {-# LANGUAGE FlexibleInstances #-}--- > {-# LANGUAGE MultiParamTypeClasses #-}--- > import Conduit--- > import Data.Serialize--- > import Database.RocksDB (createIfMissing, defaultOptions, open)--- > import Database.RocksDB.Query (KeyValue, insert, matching) -- > data MyKey = ShortKey String | FullKey String String deriving Show -- > instance Serialize MyKey where -- > put (ShortKey a) = put a@@ -87,10 +68,12 @@ -- > Just record <- runResourceT . runConduit $ -- > matching db Nothing (ShortKey "hello") .| headC -- > print (record :: (MyKey, String))+-- > -- (Fullkey "hello" "world","despite all my rage") ----- In this example you may serialize the @ShortKey@ and match all the elements--- in the database that start with it as a prefix. Deserializing will always--- yield a @FullKey@.+-- In this example the @ShortKey@ is serialized to the prefix of the only+-- element in the database, which is then returned. Since the 'get' function of+-- the 'Serialize' instance for @MyKey@ only understands how to deserialize a+-- @FullKey@, then that is what is returned. matching :: ( MonadResource m , KeyValue key value