InfluxElixir.Query.ResponseParser (InfluxElixir v0.1.14)

Copy Markdown View Source

Parses InfluxDB query responses in JSONL, CSV, JSON, and Parquet formats with type coercion.

Type Coercion

  • Timestamps → DateTime.t()
  • Numbers → integer() or float() based on value
  • Booleans → true / false
  • Strings → String.t()

Summary

Functions

Coerces known value types in a row map.

Parses a response body based on the specified format.

Functions

coerce_types(row)

@spec coerce_types(map()) :: map()

Coerces known value types in a row map.

Converts RFC3339 timestamp strings to DateTime, leaves other types as-is.

parse(body, format \\ :json)

@spec parse(binary(), atom()) :: {:ok, [map()]} | {:error, term()}

Parses a response body based on the specified format.

Parameters

  • body - response body binary
  • format - one of :json, :jsonl, :csv, :parquet

Returns

  • {:ok, [map()]} — list of row maps
  • {:error, reason} — parse failure