# `TzWorld.Backend`
[🔗](https://github.com/kipcole9/tz_world/blob/v2.5.0/lib/tz_world/backend.ex#L1)

The behaviour a time zone lookup backend implements.

`TzWorld` answers lookups by calling the running backend, normally
`TzWorld.Backend.SpatialIndex`. A custom backend implements these
callbacks, runs in the application's supervision tree registered under
its module name, and is made the default with:

    config :tz_world, default_backend: MyApp.TzWorldBackend

`TzWorld` validates points before it calls a backend, so a backend
always receives a `Geo.Point` whose coordinates are numbers within
range.

# `geo`

```elixir
@type geo() :: Geo.Point.t()
```

A point whose coordinates are `{lng, lat}`.

# `lat`

```elixir
@type lat() :: number()
```

Latitude in degrees, from -90 to 90.

# `lng`

```elixir
@type lng() :: number()
```

Longitude in degrees, from -180 to 180.

# `all_timezones_at`

```elixir
@callback all_timezones_at(geo()) :: {:ok, [String.t()]} | {:error, atom()}
```

Returns every time zone at a point, as `{:ok, time_zones}` with an
empty list if no time zone contains it.

# `reload_timezone_data`

```elixir
@callback reload_timezone_data() :: {:ok, term()} | {:error, term()}
```

Reloads the time zone data after `mix tz_world.update` has installed a
new release.

# `timezone_at`

```elixir
@callback timezone_at(geo()) :: {:ok, String.t()} | {:error, atom()}
```

Returns the time zone at a point: `{:ok, time_zone}`, or
`{:error, :time_zone_not_found}` if no time zone contains it.

# `version`

```elixir
@callback version() :: {:ok, String.t()} | {:error, term()}
```

Returns the version of the loaded time zone data, as `{:ok, version}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
