ExTeal.Metric.TrendExpression behaviour (ExTeal v0.21.0) View Source

Behaviour for trend expression builders

Link to this section Summary

Callbacks

Use database specifc syntax to build an expression for both selecting and grouping by a given unit of time. The function uses select_merge to build a date_result value assuming that a previous select has been used to generate a query for the aggregate.

Link to this section Types

Specs

valid_timezone() :: String.t() | integer() | :utc | :local

Link to this section Callbacks

Link to this callback

generate( query, metric, timezone, unit, start_dt )

View Source

Specs

generate(
  query :: Ecto.Queryable.t(),
  metric :: module(),
  timezone :: String.t(),
  unit :: String.t(),
  start_dt :: DateTime.t()
) :: Ecto.Queryable.t()

Use database specifc syntax to build an expression for both selecting and grouping by a given unit of time. The function uses select_merge to build a date_result value assuming that a previous select has been used to generate a query for the aggregate.

Link to this section Functions

Link to this function

fetch_offset(timezone, datetime)

View Source

Specs

fetch_offset(timezone :: String.t(), datetime :: DateTime.t()) :: float()