Various refactoring and typespec improvements

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-09-24 16:46:42 +02:00
parent d235653876
commit 1893d9f55b
142 changed files with 1854 additions and 1297 deletions

View File

@@ -42,7 +42,8 @@ defmodule Mobilizon.Service.Geospatial.Provider do
iex> geocode(48.11, -1.77)
%Address{}
"""
@callback geocode(longitude :: number, latitude :: number, options :: keyword) :: [Address.t()]
@callback geocode(longitude :: number, latitude :: number, options :: keyword) ::
[Address.t()] | {:error, atom()}
@doc """
Search for an address
@@ -62,12 +63,12 @@ defmodule Mobilizon.Service.Geospatial.Provider do
iex> search("10 rue Jangot")
%Address{}
"""
@callback search(address :: String.t(), options :: keyword) :: [Address.t()]
@callback search(address :: String.t(), options :: keyword) :: [Address.t()] | {:error, atom()}
@doc """
Returns a `Geo.Point` for given coordinates
"""
@spec coordinates([number], number) :: Geo.Point.t() | nil
@spec coordinates([number | String.t()], number) :: Geo.Point.t() | nil
def coordinates(coords, srid \\ 4326)
def coordinates([x, y], srid) when is_number(x) and is_number(y) do