influxdb-1.6.1.2: Haskell client library for InfluxDB

Safe HaskellNone
LanguageHaskell2010

Database.InfluxDB.JSON

Contents

Synopsis

Result parsers

parseResultsWith #

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 with the lenientDecoder. This can be useful to implement the parseResults method.

parseResultsWithDecoder #

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 the specified decoder settings.

Decoder settings

data Decoder a #

Decoder settings

Constructors

Decoder 

Fields

strictDecoder :: Decoder a #

A decoder that fails immediately if there's any parse failure.

lenientDecoder :: Decoder a #

A decoder that ignores parse failures and returns only successful results.

Getting fields and tags

getField #

Arguments

:: Monad m 
=> Text

Column name

-> Vector Text

Columns

-> Vector Value

Field values

-> m Value 

Get a field value from a column name

getTag #

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 #

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

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

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

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

Parse a RFC3339-formatted timestamp.

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

parseQueryField :: Value -> Parser QueryField #

Deprecated: This function parses numbers in a misleading way. Use parseJSON instead.

Parse a QueryField.

Utility functions

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

Parse a result response.

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

Parse a series response.

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

Parse the common JSON structure used in query responses.

parseErrorObject :: Value -> Parser a #

Parse the common JSON structure used in failure response.