I have a field called estimated_hours in one of my Ash resource called tasks. I want the datatype of this field to be Postgres interval. I want to calculate how many hours does user wants to complete a task and i will also calculate the sum of these estimated hours.
So in Ash, the primary drive for this would be a custom type. Something like:
defmodule MyApp.Interval do
use Ash.Type
def storage_type(_), do: :interval # you'll have to experiment with what the appropriate storage_type is here
# define cast_input, cast_stored, dump_to_native
end
I haven’t wrapped a built in Postgrex type in quite some time, but take a look at the docs for Ash.Type for info on defining a custom type, that may be enough to get it over the line