influxdb-1.2.2.3: Haskell client library for InfluxDB

Safe HaskellNone
LanguageHaskell2010

Database.InfluxDB.JSON

Contents

Synopsis

Result parsers

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) 

A helper function to parse a JSON response in parseResults.

parseResultsWithDecoder Source #

Arguments

:: Decoder a 
-> (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 with specified decoder settings.

Decoder settings

data Decoder a Source #

Decoder settings

Constructors

Decoder 

Fields

strictDecoder :: Decoder a Source #

Fail immediately if there's any parse failure.

lenientDecoder :: Decoder a Source #

Ignore parse failures and return successful results.

Getting fields and tags

getField Source #

Arguments

:: Monad m 
=> Text

Column name

-> Vector Text

Columns

-> Vector Value

Field values

-> m Value 

Get a field value from a column name

getTag Source #

Arguments

:: Monad m 
=> Text

Tag name

-> HashMap Text Value

Tags

-> m Value 

Get a tag value from a tag name

Common JSON object parsers

parseUTCTime :: Precision ty -> Value -> Parser UTCTime Source #

Parse either a POSIX timestamp or RFC3339 formatted timestamp as UTCTime.

parsePOSIXTime :: Precision ty -> Value -> Parser POSIXTime Source #

Parse either a POSIX timestamp or RFC3339 formatted timestamp as POSIXTime.

parseRFC3339 :: ParseTime time => Value -> Parser time Source #

Parse a RFC3339-formatted timestamp.

Note that this parser is slow as it converts a Text input to a String before parsing.

Utility functions

parseResultsObject :: Value -> Parser (Vector Value) Source #

Parse a result response.

parseSeriesObject :: Value -> Parser (Vector Value) Source #

Parse a series response.

parseSeriesBody :: Value -> Parser (Maybe Text, HashMap Text Text, Vector Text, Array) Source #

Parse the common JSON structure used in query responses.

parseErrorObject :: Value -> Parser a Source #

Parse the common JSON structure used in failure response.