View Source TimeZoneInfo.DataStore behaviour (TimeZoneInfo v0.7.2)

A behaviour to store data and serve them later on.

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 transitions for a given time_zone.

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

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.

Callbacks

@callback delete!() :: :ok

Deletes all data in the data store.

@callback empty?() :: boolean()

Returns true if the DataSore is empty.

@callback fetch_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

fetch_transitions(time_zone)

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

Returns the transitions for a given time_zone.

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

@callback info() :: term()

Returns infos about the data store.

@callback put(data :: TimeZoneInfo.data()) :: :ok | :error

Puts the given data into the store.

@callback version() :: String.t() | nil

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