influxdb-1.1.2.1: Haskell client library for InfluxDB

Safe HaskellNone
LanguageHaskell2010

Database.InfluxDB.Query

Contents

Synopsis

Query interface

query :: QueryResults a => QueryParams -> Query -> IO (Vector a) Source #

Query data from InfluxDB.

It may throw InfluxException.

queryChunked Source #

Arguments

:: QueryResults a 
=> QueryParams 
-> Optional Int

Chunk size

By Default, InfluxDB chunks responses by series or by every 10,000 points, whichever occurs first. If it set to a Specific value, InfluxDB chunks responses by series or by that number of points.

-> Query 
-> FoldM IO (Vector a) r 
-> IO r 

Same as query but it instructs InfluxDB to stream chunked responses rather than returning a huge JSON object. This can be lot more efficient than query if the result is huge.

It may throw InfluxException.

Query parameters

data QueryParams Source #

The full set of parameters for the query API

Instances

HasCredentials QueryParams Source # 
HasManager QueryParams Source #
>>> let p = queryParams "foo"
>>> p & manager .~ Left HC.defaultManagerSettings
HasDatabase QueryParams Source #
>>> let p = queryParams "foo"
>>> p ^. database
"foo"
HasServer QueryParams Source #
>>> let p = queryParams "foo"
>>> p ^. server.host
"localhost"
HasPrecision QueryRequest QueryParams Source #

Returning JSON responses contain timestamps in the specified precision/format.

>>> let p = queryParams "foo"
>>> p ^. precision
Nanosecond

manager :: HasManager a => Lens' a (Either ManagerSettings Manager) Source #

HTTP manager settings or a manager itself.

If it's set to ManagerSettings, the library will create a Manager from the settings for you.

Parsing results

class QueryResults a where Source #

Minimal complete definition

parseResults

Instances

QueryResults Void Source # 
QueryResults ShowSeries Source # 
QueryResults ShowQuery Source # 
((~) * a Value, (~) * b Value) => QueryResults (a, b) Source # 
((~) * a Value, (~) * b Value, (~) * c Value) => QueryResults (a, b, c) Source # 
((~) * a Value, (~) * b Value, (~) * c Value, (~) * d Value) => QueryResults (a, b, c, d) Source # 

Methods

parseResults :: Precision QueryRequest -> Value -> Parser (Vector (a, b, c, d)) Source #

((~) * a Value, (~) * b Value, (~) * c Value, (~) * d Value, (~) * e Value) => QueryResults (a, b, c, d, e) Source # 

Methods

parseResults :: Precision QueryRequest -> Value -> Parser (Vector (a, b, c, d, e)) Source #

((~) * a Value, (~) * b Value, (~) * c Value, (~) * d Value, (~) * e Value, (~) * f Value) => QueryResults (a, b, c, d, e, f) Source # 

Methods

parseResults :: Precision QueryRequest -> Value -> Parser (Vector (a, b, c, d, e, f)) Source #

((~) * a Value, (~) * b Value, (~) * c Value, (~) * d Value, (~) * e Value, (~) * f Value, (~) * g Value) => QueryResults (a, b, c, d, e, f, g) Source # 

Methods

parseResults :: Precision QueryRequest -> Value -> Parser (Vector (a, b, c, d, e, f, g)) Source #

((~) * a Value, (~) * b Value, (~) * c Value, (~) * d Value, (~) * e Value, (~) * f Value, (~) * g Value, (~) * h Value) => QueryResults (a, b, c, d, e, f, g, h) Source # 

Methods

parseResults :: Precision QueryRequest -> Value -> Parser (Vector (a, b, c, d, e, f, g, h)) Source #

parseResultsWith Source #

Arguments

:: (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> Parser a)

A parser that takes

  1. an optional name of the series
  2. a map of tags
  3. an array of field names
  4. an array of values

to construct a value.

-> Value 
-> Parser (Vector a) 

Parse a JSON response

Low-level functions

withQueryResponse Source #

Arguments

:: QueryParams 
-> Maybe (Optional Int)

Chunk size

By Nothing, InfluxDB returns all matching data points at once. By Just Default, InfluxDB chunks responses by series or by every 10,000 points, whichever occurs first. If it set to a Specific value, InfluxDB chunks responses by series or by that number of points.

-> Query 
-> (Request -> Response BodyReader -> IO r) 
-> IO r