ha1973
AEAsh Elixir
•Created by ha1973 on 9/8/2023 in #support
Use without data layers
That did the trick, thank you !
10 replies
AEAsh Elixir
•Created by ha1973 on 9/8/2023 in #support
Use without data layers
I will probably need to do some more reading
10 replies
AEAsh Elixir
•Created by ha1973 on 9/8/2023 in #support
Use without data layers
Ash.Query.for_read(Asher.Edge.Myip, :read) |> Asher.Edge.read!()
(Ash.Error.Unknown) Unknown Error
Context: resolving data on process Asher.Edge.Myip.read
* Context: resolving data on process Asher.Edge.Myip.read
(Protocol.UndefinedError) protocol Enumerable not implemented for #Asher.Edge.Myip<meta: #Ecto.Schema.Metadata<:built, "">, id: nil, origin: "80.208.68.43", aggregates: %{}, calculations: %{}, ...> of type Asher.Edge.Myip (a struct). This protocol is implemented for the following type(s): Date.Range, File.Stream, Fu
10 replies
AEAsh Elixir
•Created by ha1973 on 9/8/2023 in #support
Use without data layers
defmodule Asher.Edge.FetchMyip do
use Ash.Resource.Preparation
def prepare(query, _, _) do
case Req.get("https://httpbin.org/ip") do
{:ok,
%Req.Response{
status: 200,
body: data
}} ->
# data =
# Asher.Edge.Myip
# |> Ash.Changeset.for_create(:create, %{origin: data["origin"]})
# |> Asher.Edge.create!()
Ash.DataLayer.Simple.set_data(query, %Asher.Edge.Myip{origin: data["origin"]})
{:error, error} ->
Ash.Query.add_error(query, "doh #{inspect(error)}")
end
end
end
10 replies
AEAsh Elixir
•Created by ha1973 on 9/8/2023 in #support
Use without data layers
Thx, if i do it like this,
10 replies