I want to add an aggregate that returns the count of children based on the children relationship but it is throwing :count is not a valid type. It seems like Ash expect types other than :count, but when I consulted Ash.Resource.Builder — ash v3.5.36, it appeared to me that :count should work.
What could I be getting wrong?
I am using Ash.DataLayer.Ets data layer.
defmodule MyExtension.Transformers.AddChildrenCountAggregate do
use Spark.Dsl.Transformer
def transform(dsl_state) do
Ash.Resource.Builder.add_new_aggregate(
dsl_state,
:count_of_children,
:count,
:children
)
end
end
throws
:count is not a valid type.
Valid types include any custom types, or the following short codes (alongside the types they map to):
:map -> Ash.Type.Map
:keyword -> Ash.Type.Keyword
:term -> Ash.Type.Term
:atom -> Ash.Type.Atom
:tuple -> Ash.Type.Tuple
:string -> Ash.Type.String
:integer -> Ash.Type.Integer
:file -> Ash.Type.File
:float -> Ash.Type.Float
:duration_name -> Ash.Type.DurationName
:function -> Ash.Type.Function
:boolean -> Ash.Type.Boolean
:struct -> Ash.Type.Struct
:uuid -> Ash.Type.UUID
:uuid_v7 -> Ash.Type.UUIDv7
:binary -> Ash.Type.Binary
:date -> Ash.Type.Date
:time -> Ash.Type.Time
:time_usec -> Ash.Type.TimeUsec
:decimal -> Ash.Type.Decimal
:ci_string -> Ash.Type.CiString
:naive_datetime -> Ash.Type.NaiveDatetime
:utc_datetime -> Ash.Type.UtcDatetime
:utc_datetime_usec -> Ash.Type.UtcDatetimeUsec
:datetime -> Ash.Type.DateTime
:duration -> Ash.Type.Duration
:url_encoded_binary -> Ash.Type.UrlEncodedBinary
:union -> Ash.Type.Union
:module -> Ash.Type.Module
:vector -> Ash.Type.Vector




















