AshWorkflow.Duration (AshWorkflow v0.6.0)

Copy Markdown View Source

The duration tuple a timeout measures with fire_after and a retry block waits with backoff.

It exists so both read the same tuple: {3, :days}, {10, :seconds}.

Summary

Functions

Converts a duration to milliseconds.

Converts a duration to seconds.

Validates a duration tuple, for use as a Spark {:custom, ...} schema type.

Types

t()

@type t() :: {pos_integer(), unit()}

unit()

@type unit() :: :seconds | :minutes | :hours | :days

Functions

to_milliseconds(arg)

@spec to_milliseconds(t()) :: pos_integer()

Converts a duration to milliseconds.

to_seconds(arg)

@spec to_seconds(t()) :: pos_integer()

Converts a duration to seconds.

validate(other)

@spec validate(term()) :: {:ok, t()} | {:error, String.t()}

Validates a duration tuple, for use as a Spark {:custom, ...} schema type.