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?
Solution:
read actions always return lists of records pertaining to the resource
Jump to solution
8 Replies
ZachDaniel
ZachDaniel4mo ago
Must be generic
Solution
ZachDaniel
ZachDaniel4mo ago
read actions always return lists of records pertaining to the resource
Terris
TerrisOP4mo ago
Thanks. Already coded it as generic. But I just saw your AshAi talk and saw that “read” is used .. to search.. embeddings??
ZachDaniel
ZachDaniel4mo ago
Yeah, you can return records w/ calculations filled in, or with metadata in record.__metadata__ as needed but always a list of records
Terris
TerrisOP4mo ago
I don’t think I understand what a record is .. and geez I’ve been Ashing for a while now
Rebecca Le
Rebecca Le4mo ago
the resource struct ie. a read action in a User resource will return a list of %User{} structs
Terris
TerrisOP4mo ago
Thanks Rebecca!
ZachDaniel
ZachDaniel4mo ago
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 🤔

Did you find this page helpful?