mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: attempt to fix calculation compile time issues
This commit is contained in:
parent
fa192944e0
commit
382d39175b
2 changed files with 9 additions and 0 deletions
|
@ -2,6 +2,12 @@ defmodule Ash.Resource.Calculation.Expression do
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
use Ash.Calculation, type: :string
|
use Ash.Calculation, type: :string
|
||||||
|
|
||||||
|
@doc false
|
||||||
|
# This exists to fix some very strange
|
||||||
|
# compile time errors, whereby Code.ensure_compiled(this_module)
|
||||||
|
# doesn't work, but calling a function on it does
|
||||||
|
def check, do: :ok
|
||||||
|
|
||||||
def expression(opts, context) do
|
def expression(opts, context) do
|
||||||
expr =
|
expr =
|
||||||
Ash.Filter.build_filter_from_template(opts[:expr], nil, context, context[:context] || %{})
|
Ash.Filter.build_filter_from_template(opts[:expr], nil, context, context[:context] || %{})
|
||||||
|
|
|
@ -10,6 +10,9 @@ defmodule Ash.Sort do
|
||||||
|
|
||||||
alias Ash.Error.Query.{InvalidSortOrder, NoSuchAttribute}
|
alias Ash.Error.Query.{InvalidSortOrder, NoSuchAttribute}
|
||||||
|
|
||||||
|
# See the comment in that module for more on why this is here
|
||||||
|
Ash.Resource.Calculation.Expression.check()
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
A utility for parsing sorts provided from external input. Only allows sorting
|
A utility for parsing sorts provided from external input. Only allows sorting
|
||||||
on public attributes and aggregates.
|
on public attributes and aggregates.
|
||||||
|
|
Loading…
Reference in a new issue