Ash FrameworkAF
Ash Framework•6mo ago•
38 replies
ken-kost

Custom query run in action

I'm wondering how to run a regular query (SELECT ...) in an action for example using Repo.query! šŸ¤” my attempts fail. Seems I can't use the Repo module in an action 😬
Solution
I literally showed you how to do it.
action :activity_this_month, :map do
  run fn input, _ -> 
    """
    SELECT * FROM my_table
    """
    |> MyApp.Repo.query!()
  end
end
Was this page helpful?