Skip to content

Commit

Permalink
Also support Durations
Browse files Browse the repository at this point in the history
In Postgrex v0.19, users can choose to emit
Elixir's new durations structs instead of
Postgrex.Interval, so let's convert them too.

This will require Elixir v1.18+.
  • Loading branch information
josevalim authored Dec 3, 2024
1 parent 8ed9b3d commit 26225f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ecto_psql_extras.ex
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ defmodule EctoPSQLExtras do
end

@doc false
def format_value({%struct{} = value, _}) when struct in [Decimal, Postgrex.Interval],
def format_value({%struct{} = value, _}) when struct in [Decimal, Duration, Postgrex.Interval],
do: struct.to_string(value)

def format_value({nil, _}), do: ""
Expand Down

0 comments on commit 26225f1

Please sign in to comment.