TimeZoneInfo.DataStore behaviour (TimeZoneInfo v0.7.9)
View SourceA 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.
@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:
:ignorejust the time zone names will be returned:onlyjust the link name will be returned:includethe 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.