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

Behaviour for trend expression builders

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.

Types

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

Callbacks

Link to this callback

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

View Source
@callback 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.

Functions

Link to this function

fetch_offset(timezone, datetime)

View Source
@spec fetch_offset(timezone :: String.t(), datetime :: DateTime.t()) :: float()