kamaroly
Resource.Builder.add_new_aggregate raises :count is not a valid type
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.29.3, 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
Marked As Solved
kamaroly
This was fixed in the main branch: fix: properly add aggregate with `add_new_aggregate` · ash-project/ash@a95228e · GitHub
0
Popular in Questions
Hello, how can I check the Phoenix version ?
Thanks !
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Other popular topics
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Latest Ash Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









