Skip to content

Commit

Permalink
Group cast/1 together
Browse files Browse the repository at this point in the history
  • Loading branch information
marmor157 authored Apr 30, 2024
1 parent e9a0eb3 commit 57fb90f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/geo_postgis/geometry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ if Code.ensure_loaded?(Ecto.Type) do
do_cast(geom)
end

def cast(_), do: :error

defp do_cast(geom) when is_binary(geom) do
case Geo.PostGIS.Config.json_library().decode(geom) do
{:ok, geom} when is_map(geom) -> do_cast(geom)
Expand All @@ -103,8 +105,6 @@ if Code.ensure_loaded?(Ecto.Type) do
end
end

def cast(_), do: :error

def embed_as(_), do: :self

def equal?(a, b), do: a == b
Expand Down

0 comments on commit 57fb90f

Please sign in to comment.