mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 21:43:02 +12:00
improvement: improve compile times with 🪄
This commit is contained in:
parent
de550e7bac
commit
5bfc1aeb0c
2 changed files with 11 additions and 4 deletions
|
@ -189,7 +189,7 @@ defmodule Ash.Resource.Dsl do
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
modules: [:destination],
|
no_depend_modules: [:destination],
|
||||||
target: Ash.Resource.Relationships.HasOne,
|
target: Ash.Resource.Relationships.HasOne,
|
||||||
schema: Ash.Resource.Relationships.HasOne.opt_schema(),
|
schema: Ash.Resource.Relationships.HasOne.opt_schema(),
|
||||||
args: [:name, :destination]
|
args: [:name, :destination]
|
||||||
|
@ -212,7 +212,7 @@ defmodule Ash.Resource.Dsl do
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
target: Ash.Resource.Relationships.HasMany,
|
target: Ash.Resource.Relationships.HasMany,
|
||||||
modules: [:destination],
|
no_depend_modules: [:destination],
|
||||||
schema: Ash.Resource.Relationships.HasMany.opt_schema(),
|
schema: Ash.Resource.Relationships.HasMany.opt_schema(),
|
||||||
args: [:name, :destination]
|
args: [:name, :destination]
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ defmodule Ash.Resource.Dsl do
|
||||||
belongs_to :word, Word, primary_key?: true, allow_nil?: false
|
belongs_to :word, Word, primary_key?: true, allow_nil?: false
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
modules: [:destination, :through],
|
no_depend_modules: [:destination, :through],
|
||||||
target: Ash.Resource.Relationships.ManyToMany,
|
target: Ash.Resource.Relationships.ManyToMany,
|
||||||
schema: Ash.Resource.Relationships.ManyToMany.opt_schema(),
|
schema: Ash.Resource.Relationships.ManyToMany.opt_schema(),
|
||||||
transform: {Ash.Resource.Relationships.ManyToMany, :transform, []},
|
transform: {Ash.Resource.Relationships.ManyToMany, :transform, []},
|
||||||
|
@ -267,7 +267,7 @@ defmodule Ash.Resource.Dsl do
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
modules: [:destination],
|
no_depend_modules: [:destination],
|
||||||
target: Ash.Resource.Relationships.BelongsTo,
|
target: Ash.Resource.Relationships.BelongsTo,
|
||||||
schema: Ash.Resource.Relationships.BelongsTo.opt_schema(),
|
schema: Ash.Resource.Relationships.BelongsTo.opt_schema(),
|
||||||
args: [:name, :destination]
|
args: [:name, :destination]
|
||||||
|
|
|
@ -108,6 +108,13 @@ defmodule Ash.Schema do
|
||||||
alias Ash.Query.Aggregate
|
alias Ash.Query.Aggregate
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
@primary_key false
|
@primary_key false
|
||||||
|
after_compile = @after_compile -- [{__MODULE__, :__after_compile__}]
|
||||||
|
Module.delete_attribute(__MODULE__, :after_compile)
|
||||||
|
Module.register_attribute(__MODULE__, :after_compile, accumulate: true)
|
||||||
|
|
||||||
|
for compile_hook <- after_compile do
|
||||||
|
@after_compile compile_hook
|
||||||
|
end
|
||||||
|
|
||||||
schema Ash.DataLayer.source(__MODULE__) do
|
schema Ash.DataLayer.source(__MODULE__) do
|
||||||
for attribute <- Ash.Resource.Info.attributes(__MODULE__),
|
for attribute <- Ash.Resource.Info.attributes(__MODULE__),
|
||||||
|
|
Loading…
Reference in a new issue