mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
29 lines
551 B
Elixir
29 lines
551 B
Elixir
defmodule AshPostgres.Test.Entity do
|
|
@moduledoc false
|
|
|
|
use Ash.Resource,
|
|
data_layer: AshPostgres.DataLayer
|
|
|
|
attributes do
|
|
uuid_primary_key(:id)
|
|
|
|
attribute(:full_name, :string, allow_nil?: false)
|
|
|
|
timestamps(private?: false)
|
|
end
|
|
|
|
postgres do
|
|
table "entities"
|
|
repo AshPostgres.TestRepo
|
|
end
|
|
|
|
actions do
|
|
defaults([:create, :read])
|
|
|
|
read :read_from_temp do
|
|
prepare(fn query, _ ->
|
|
Ash.Query.set_context(query, %{data_layer: %{table: "temp_entities", schema: "temp"}})
|
|
end)
|
|
end
|
|
end
|
|
end
|