influxdb 1.5.1 → 1.5.2
raw patch · 7 files changed
+30/−14 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Database.InfluxDB: Decoder :: (Parser a -> Parser b) -> (Parser (Vector b) -> Parser (Vector a)) -> Decoder a
+ Database.InfluxDB: [decodeEach] :: Decoder a -> Parser a -> Parser b
+ Database.InfluxDB: [decodeFold] :: Decoder a -> Parser (Vector b) -> Parser (Vector a)
+ Database.InfluxDB: data Decoder a
+ Database.InfluxDB: lenientDecoder :: Decoder a
+ Database.InfluxDB: parseResultsWithDecoder :: Decoder a -> (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> Parser a) -> Value -> Parser (Vector a)
+ Database.InfluxDB: strictDecoder :: Decoder a
Files
- CHANGELOG.md +5/−0
- influxdb.cabal +1/−2
- src/Database/InfluxDB.hs +6/−2
- src/Database/InfluxDB/JSON.hs +8/−8
- src/Database/InfluxDB/Line.hs +2/−1
- src/Database/InfluxDB/Query.hs +7/−0
- src/Database/InfluxDB/Types.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for influxdb +## v1.5.2 - 2018-04-11++* Export parseResultsWithDecoder, Decoder, lenientDecoder and strictDecoder from Database.InfluxDB+* Extend haddock comments+ ## v1.5.1 - 2018-03-29 * Add basic auth support for query (#58)
influxdb.cabal view
@@ -1,5 +1,5 @@ name: influxdb-version: 1.5.1+version: 1.5.2 synopsis: Haskell client library for InfluxDB description: @influxdb@ is a Haskell client library for InfluxDB.@@ -14,7 +14,6 @@ category: Database build-type: Custom cabal-version: >= 1.24-tested-with: GHC >= 7.10 && < 8.1 tested-with: GHC == 7.10.3 GHC == 8.0.2
src/Database/InfluxDB.hs view
@@ -5,7 +5,7 @@ module Database.InfluxDB ( -- $intro - -- * Writing data+ -- * Writing data via HTTP -- $write write , writeBatch@@ -50,6 +50,10 @@ -- $parsing-results , QueryResults(..) , parseResultsWith+ , parseResultsWithDecoder+ , Decoder(..)+ , lenientDecoder+ , strictDecoder , getField , getTag , parseUTCTime@@ -120,7 +124,7 @@ package in some APIs. Here we use 'Control.Lens.?~' to set the authentication parameters of type @Maybe 'Credentials'@. -Also note that in order to construct a 'Query', we use 'formatQuery' with the+Also note that in order to construct a 'Query', we use 'F.formatQuery' with the 'F.database' formatter. There are many other formatters defined in "Database.InfluxDB.Format".
src/Database/InfluxDB/JSON.hs view
@@ -50,8 +50,8 @@ import Database.InfluxDB.Types --- | A helper function to parse a JSON response in--- 'Database.InfluxDB.Query.parseResults'.+-- | Parse a JSON response with the 'lenientDecoder'. This can be useful to+-- implement the 'Database.InfluxDB.Query.parseResults' method. parseResultsWith :: (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> A.Parser a) -- ^ A parser that takes@@ -66,7 +66,7 @@ -> A.Parser (Vector a) parseResultsWith = parseResultsWithDecoder lenientDecoder --- | Parse a JSON response with specified decoder settings.+-- | Parse a JSON response with the specified decoder settings. parseResultsWithDecoder :: Decoder a -> (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> A.Parser a)@@ -97,20 +97,20 @@ -- | Decoder settings data Decoder a = forall b. Decoder { decodeEach :: A.Parser a -> A.Parser b- -- ^ How to turn a parser for each element into another. For example, a- -- failure can be turned into 'Nothing'.+ -- ^ How to decode each row. For example 'optional' can be used to turn parse+ -- failrues into 'Nothing's. , decodeFold :: A.Parser (Vector b) -> A.Parser (Vector a)- -- ^ How to aggregate all results from 'decodeEach' into a vector of results.+ -- ^ How to aggregate rows into the resulting vector. } --- | Fail immediately if there's any parse failure.+-- | A decoder that fails immediately if there's any parse failure. strictDecoder :: Decoder a strictDecoder = Decoder { decodeEach = id , decodeFold = id } --- | Ignore parse failures and return successful results.+-- | A decoder that ignores parse failures and returns only successful results. lenientDecoder :: Decoder a lenientDecoder = Decoder { decodeEach = optional
src/Database/InfluxDB/Line.hs view
@@ -28,6 +28,7 @@ import Data.List (intersperse) import Data.Int (Int64) import Data.Monoid+import Prelude import Control.Lens import Data.Map (Map)@@ -64,7 +65,7 @@ -- | Placeholder for the Line Protocol ----- See https://docs.influxdata.com/influxdb/v1.2/write_protocols/line_protocol_tutorial/ for the+-- See https://docs.influxdata.com/influxdb/v1.5/write_protocols/line_protocol_tutorial/ for the -- concrete syntax. data Line time = Line { _measurement :: !Measurement
src/Database/InfluxDB/Query.hs view
@@ -210,6 +210,9 @@ -- | Query data from InfluxDB. -- -- It may throw 'InfluxException'.+--+-- If you need a lower-level interface (e.g. to bypass the 'QueryResults'+-- constraint etc), see 'withQueryResponse'. query :: QueryResults a => QueryParams -> Query -> IO (Vector a) query params q = withQueryResponse params Nothing q go where@@ -244,6 +247,9 @@ -- 'query' if the result is huge. -- -- It may throw 'InfluxException'.+--+-- If you need a lower-level interface (e.g. to bypass the 'QueryResults'+-- constraint etc), see 'withQueryResponse'. queryChunked :: QueryResults a => QueryParams@@ -282,6 +288,7 @@ loop x' k0 leftover A.Error message -> errorQuery message request response val +-- | Lower-level interface to query data. withQueryResponse :: QueryParams -> Maybe (Optional Int)
src/Database/InfluxDB/Types.hs view
@@ -34,7 +34,7 @@ -- | An InfluxDB query. -- -- A spec of the format is available at--- <https://docs.influxdata.com/influxdb/v1.2/query_language/spec/>.+-- <https://docs.influxdata.com/influxdb/v1.5/query_language/spec/>. -- -- A 'Query' can be constructed using either --