Cocktail (Cocktail v0.9.0) View Source

Top level types and convenience functions.

This module holds some top-level types and a convenience function for creating a new schedule. Details available in the Cocktail.Schedule module.

Link to this section Summary

Functions

Creates a new schedule using the given start time and options.

Link to this section Types

Specs

day() :: day_number() | day_atom()

Specs

day_atom() ::
  :monday | :tuesday | :wednesday | :thursday | :friday | :saturday | :sunday

Specs

day_number() :: 0..6

Specs

day_of_month() :: -31..-1 | 1..31

Specs

frequency() :: :monthly | :weekly | :daily | :hourly | :minutely | :secondly

Specs

hour_number() :: 0..23

Specs

minute_number() :: 0..59

Specs

occurrence() :: time() | Cocktail.Span.t()

Specs

rule_option() ::
  {:frequency, frequency()}
  | {:interval, pos_integer()}
  | {:count, pos_integer()}
  | {:until, time()}
  | {:days, [day()]}
  | {:days_of_month, [day_of_month()]}
  | {:hours, [hour_number()]}
  | {:minutes, [minute_number()]}
  | {:seconds, [second_number()]}
  | {:times, [Time.t()]}
  | {:time_range, time_range()}

Specs

rule_options() :: [rule_option()]

Specs

schedule_option() :: {:duration, pos_integer()}

Specs

schedule_options() :: [schedule_option()]

Specs

second_number() :: 0..59

Specs

time() :: DateTime.t() | NaiveDateTime.t()

Specs

time_range() :: %{
  start_time: Time.t(),
  end_time: Time.t(),
  interval_seconds: second_number()
}

Link to this section Functions

Link to this function

schedule(start_time, options \\ [])

View Source

Specs

Creates a new schedule using the given start time and options.

see Cocktail.Schedule.new/1 for details.