Can reads return anything?
I have a search action that needs to return an array of tuples consisting of a resource reference and an atom that conveys why the resource was found by the search. There is only one type of resource involved so the action fits nicely in the resource. Can this be a read action or should it be generic?
8 Replies
Must be generic
Solution
read actions always return lists of records pertaining to the resource
Thanks. Already coded it as generic. But I just saw your AshAi talk and saw that “read” is used .. to search.. embeddings??
Yeah, you can return records w/ calculations filled in, or with metadata in
record.__metadata__
as needed
but always a list of recordsI don’t think I understand what a record is .. and geez I’ve been Ashing for a while now
the resource struct
ie. a read action in a User resource will return a list of %User{} structs
Thanks Rebecca!
Its our own terminology to distinguish it because people kept calling
Both
Resource
and %Resource{}
a "resource"
The "resource" is the module
Probably worth making clearer in the getting started guide 🤔