influxdb-1.6.0.5: 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) 

Parse a JSON response with the lenientDecoder. This can be useful to implement the parseResults method.

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

Decoder settings

data Decoder a Source #

Decoder settings

Constructors

Decoder 

Fields

strictDecoder :: Decoder a Source #

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

lenientDecoder :: Decoder a Source #

A decoder that ignores parse failures and returns only 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.

parseQueryField :: Value -> Parser QueryField Source #

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

Parse a QueryField.

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.