time_zone_info v0.3.0 TimeZoneInfo.DataStore behaviour View Source

A behaviour to store data and serve them later on.

Link to this section Summary

Callbacks

Deletes all data in the data store.

Returns true if the DataSore is empty.

Returns rules for a given rule_name.

Returns the list of all available time zones with or without links. The option :links can be used to customize the list.

Returns the transitions for a given time_zone.

Returns infos about the data store.

Puts the given data into the store.

Returns the version of the IANA database from which the data was generated.

Link to this section Callbacks

Link to this callback

delete!()

View Source
delete!() :: :ok

Deletes all data in the data store.

Returns true if the DataSore is empty.

Link to this callback

get_rules(rule_name)

View Source
get_rules(rule_name :: TimeZoneInfo.rule_name()) ::
  {:ok, rules :: [TimeZoneInfo.rule()]} | {:error, :rule_not_found}

Returns rules for a given rule_name.

Link to this callback

get_time_zones(list)

View Source
get_time_zones([{:links, :ignore | :only | :include}]) :: [Calendar.time_zone()]

Returns the list of all available time zones with or without links. The option :links can be used to customize the list.

Values for :links:

  • :ignore just the time zone names will be returned
  • :only just the link name will be returned
  • :include the time zone and link names will be returned

The list will be sorted.

Link to this callback

get_transitions(time_zone)

View Source
get_transitions(time_zone :: Calendar.time_zone()) ::
  {:ok, transitions :: [TimeZoneInfo.transition()]}
  | {:error, :transitions_not_found}

Returns the transitions for a given time_zone.

Link to this callback

info()

View Source (optional)
info() :: term()

Returns infos about the data store.

Link to this callback

put(data)

View Source
put(data :: TimeZoneInfo.data()) :: :ok | :error

Puts the given data into the store.

Link to this callback

version()

View Source
version() :: String.t() | nil

Returns the version of the IANA database from which the data was generated.