mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
chore: format some with
clauses to be on a single line (#893)
This commit is contained in:
parent
ae58f0c118
commit
76a0b0f7f3
11 changed files with 44 additions and 113 deletions
|
@ -278,8 +278,7 @@ defmodule Ash.Actions.Read do
|
||||||
|
|
||||||
defp do_read(%{action: action} = query, calculations_at_runtime, calculations_in_query, opts) do
|
defp do_read(%{action: action} = query, calculations_at_runtime, calculations_in_query, opts) do
|
||||||
maybe_in_transaction(query, opts, fn ->
|
maybe_in_transaction(query, opts, fn ->
|
||||||
with %{valid?: true} = query <-
|
with %{valid?: true} = query <- handle_attribute_multitenancy(query),
|
||||||
handle_attribute_multitenancy(query),
|
|
||||||
:ok <- validate_multitenancy(query),
|
:ok <- validate_multitenancy(query),
|
||||||
{:ok, sort} <-
|
{:ok, sort} <-
|
||||||
Ash.Actions.Sort.process(
|
Ash.Actions.Sort.process(
|
||||||
|
@ -293,8 +292,7 @@ defmodule Ash.Actions.Read do
|
||||||
pre_authorization_query <- query,
|
pre_authorization_query <- query,
|
||||||
{:ok, query} <- authorize_query(query, opts),
|
{:ok, query} <- authorize_query(query, opts),
|
||||||
query_before_pagination <- query,
|
query_before_pagination <- query,
|
||||||
{:ok, query} <-
|
{:ok, query} <- paginate(query, action, opts[:page], opts[:skip_pagination?]),
|
||||||
paginate(query, action, opts[:page], opts[:skip_pagination?]),
|
|
||||||
query <-
|
query <-
|
||||||
Ash.Actions.Read.Calculations.deselect_known_forbidden_fields(
|
Ash.Actions.Read.Calculations.deselect_known_forbidden_fields(
|
||||||
query,
|
query,
|
||||||
|
@ -368,13 +366,10 @@ defmodule Ash.Actions.Read do
|
||||||
query.resource,
|
query.resource,
|
||||||
query
|
query
|
||||||
),
|
),
|
||||||
:ok <-
|
:ok <- validate_get(results, query.action, query),
|
||||||
validate_get(results, query.action, query),
|
|
||||||
results <- add_keysets(query, results, query.sort),
|
results <- add_keysets(query, results, query.sort),
|
||||||
{:ok, results} <-
|
{:ok, results} <- run_authorize_results(query, results),
|
||||||
run_authorize_results(query, results),
|
{:ok, results, after_notifications} <- run_after_action(query, results),
|
||||||
{:ok, results, after_notifications} <-
|
|
||||||
run_after_action(query, results),
|
|
||||||
{:ok, count} <- maybe_await(count) do
|
{:ok, count} <- maybe_await(count) do
|
||||||
{:ok, results, count, before_notifications ++ after_notifications}
|
{:ok, results, count, before_notifications ++ after_notifications}
|
||||||
else
|
else
|
||||||
|
@ -1997,10 +1992,8 @@ defmodule Ash.Actions.Read do
|
||||||
path_filters,
|
path_filters,
|
||||||
prefix
|
prefix
|
||||||
) do
|
) do
|
||||||
with {:ok, left} <-
|
with {:ok, left} <- do_filter_with_related(resource, left, path_filters, prefix),
|
||||||
do_filter_with_related(resource, left, path_filters, prefix),
|
{:ok, right} <- do_filter_with_related(resource, right, path_filters, prefix) do
|
||||||
{:ok, right} <-
|
|
||||||
do_filter_with_related(resource, right, path_filters, prefix) do
|
|
||||||
{:ok, Ash.Query.BooleanExpression.optimized_new(:or, left, right)}
|
{:ok, Ash.Query.BooleanExpression.optimized_new(:or, left, right)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1431,8 +1431,7 @@ defmodule Ash.Api do
|
||||||
calculation: {module, calc_opts},
|
calculation: {module, calc_opts},
|
||||||
type: type,
|
type: type,
|
||||||
constraints: constraints
|
constraints: constraints
|
||||||
}} <-
|
}} <- {:calc, Ash.Resource.Info.calculation(resource, calculation)},
|
||||||
{:calc, Ash.Resource.Info.calculation(resource, calculation)},
|
|
||||||
record <- struct(record || resource, opts[:refs] || %{}) do
|
record <- struct(record || resource, opts[:refs] || %{}) do
|
||||||
calc_context =
|
calc_context =
|
||||||
opts[:context]
|
opts[:context]
|
||||||
|
|
|
@ -525,8 +525,7 @@ defmodule Ash.Changeset do
|
||||||
)
|
)
|
||||||
|
|
||||||
with :ok <- verify_notifiers_support_atomic(resource, action),
|
with :ok <- verify_notifiers_support_atomic(resource, action),
|
||||||
%Ash.Changeset{} = changeset <-
|
%Ash.Changeset{} = changeset <- atomic_update(changeset, opts[:atomic_update] || []),
|
||||||
atomic_update(changeset, opts[:atomic_update] || []),
|
|
||||||
%Ash.Changeset{} = changeset <- atomic_params(changeset, action, params, opts),
|
%Ash.Changeset{} = changeset <- atomic_params(changeset, action, params, opts),
|
||||||
%Ash.Changeset{} = changeset <- atomic_changes(changeset, action) do
|
%Ash.Changeset{} = changeset <- atomic_changes(changeset, action) do
|
||||||
hydrate_atomic_refs(changeset, opts[:actor], Keyword.take(opts, [:eager?]))
|
hydrate_atomic_refs(changeset, opts[:actor], Keyword.take(opts, [:eager?]))
|
||||||
|
|
|
@ -361,17 +361,14 @@ defmodule Ash.DataLayer.Ets do
|
||||||
parent \\ nil
|
parent \\ nil
|
||||||
) do
|
) do
|
||||||
with {:ok, records} <- get_records(resource, tenant),
|
with {:ok, records} <- get_records(resource, tenant),
|
||||||
{:ok, records} <-
|
{:ok, records} <- filter_matches(records, filter, api, parent),
|
||||||
filter_matches(records, filter, api, parent),
|
|
||||||
records <- Sort.runtime_sort(records, distinct_sort || sort, api: api),
|
records <- Sort.runtime_sort(records, distinct_sort || sort, api: api),
|
||||||
records <- Sort.runtime_distinct(records, distinct, api: api),
|
records <- Sort.runtime_distinct(records, distinct, api: api),
|
||||||
records <- Sort.runtime_sort(records, sort, api: api),
|
records <- Sort.runtime_sort(records, sort, api: api),
|
||||||
records <- Enum.drop(records, offset || []),
|
records <- Enum.drop(records, offset || []),
|
||||||
records <- do_limit(records, limit),
|
records <- do_limit(records, limit),
|
||||||
{:ok, records} <-
|
{:ok, records} <- do_add_aggregates(records, api, resource, aggregates),
|
||||||
do_add_aggregates(records, api, resource, aggregates),
|
{:ok, records} <- do_add_calculations(records, resource, calculations, api) do
|
||||||
{:ok, records} <-
|
|
||||||
do_add_calculations(records, resource, calculations, api) do
|
|
||||||
{:ok, records}
|
{:ok, records}
|
||||||
else
|
else
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
|
@ -651,10 +648,8 @@ defmodule Ash.DataLayer.Ets do
|
||||||
[record],
|
[record],
|
||||||
api
|
api
|
||||||
),
|
),
|
||||||
{:ok, filtered} <-
|
{:ok, filtered} <- filter_matches(related, query.filter, api),
|
||||||
filter_matches(related, query.filter, api),
|
sorted <- Sort.runtime_sort(filtered, query.sort, api: api) do
|
||||||
sorted <-
|
|
||||||
Sort.runtime_sort(filtered, query.sort, api: api) do
|
|
||||||
field = field || Enum.at(Ash.Resource.Info.primary_key(query.resource), 0)
|
field = field || Enum.at(Ash.Resource.Info.primary_key(query.resource), 0)
|
||||||
|
|
||||||
value =
|
value =
|
||||||
|
@ -1023,8 +1018,7 @@ defmodule Ash.DataLayer.Ets do
|
||||||
with {:ok, table} <- wrap_or_create_table(resource, changeset.tenant),
|
with {:ok, table} <- wrap_or_create_table(resource, changeset.tenant),
|
||||||
{:ok, record} <- Ash.Changeset.apply_attributes(changeset),
|
{:ok, record} <- Ash.Changeset.apply_attributes(changeset),
|
||||||
record <- unload_relationships(resource, record),
|
record <- unload_relationships(resource, record),
|
||||||
{:ok, record} <-
|
{:ok, record} <- put_or_insert_new(table, {pkey, record}, resource) do
|
||||||
put_or_insert_new(table, {pkey, record}, resource) do
|
|
||||||
{:ok, set_loaded(record)}
|
{:ok, set_loaded(record)}
|
||||||
else
|
else
|
||||||
{:error, error} -> {:error, Ash.Error.to_ash_error(error)}
|
{:error, error} -> {:error, Ash.Error.to_ash_error(error)}
|
||||||
|
|
|
@ -228,8 +228,7 @@ defmodule Ash.EmbeddableType do
|
||||||
|> Ash.Resource.Info.attributes()
|
|> Ash.Resource.Info.attributes()
|
||||||
|> Enum.reduce_while({:ok, struct(__MODULE__)}, fn attr, {:ok, struct} ->
|
|> Enum.reduce_while({:ok, struct(__MODULE__)}, fn attr, {:ok, struct} ->
|
||||||
with {:fetch, {:ok, value}} <- {:fetch, fetch_key(value, attr.name)},
|
with {:fetch, {:ok, value}} <- {:fetch, fetch_key(value, attr.name)},
|
||||||
{:ok, casted} <-
|
{:ok, casted} <- Ash.Type.cast_stored(attr.type, value, attr.constraints) do
|
||||||
Ash.Type.cast_stored(attr.type, value, attr.constraints) do
|
|
||||||
{:cont, {:ok, Map.put(struct, attr.name, casted)}}
|
{:cont, {:ok, Map.put(struct, attr.name, casted)}}
|
||||||
else
|
else
|
||||||
{:fetch, :error} ->
|
{:fetch, :error} ->
|
||||||
|
|
|
@ -1080,8 +1080,7 @@ defmodule Ash.Engine.Request do
|
||||||
defp do_try_resolve_local(request, field, unresolved, internal?) do
|
defp do_try_resolve_local(request, field, unresolved, internal?) do
|
||||||
%{deps: deps, resolver: resolver} = unresolved
|
%{deps: deps, resolver: resolver} = unresolved
|
||||||
|
|
||||||
with {:ok, new_request, notifications, []} <-
|
with {:ok, new_request, notifications, []} <- try_resolve(request, deps, internal?) do
|
||||||
try_resolve(request, deps, internal?) do
|
|
||||||
resolver_context = resolver_context(new_request, deps)
|
resolver_context = resolver_context(new_request, deps)
|
||||||
|
|
||||||
log(request, fn -> "resolving #{field}" end)
|
log(request, fn -> "resolving #{field}" end)
|
||||||
|
|
|
@ -2557,20 +2557,10 @@ defmodule Ash.Filter do
|
||||||
function_module ->
|
function_module ->
|
||||||
nested_statement = Tuple.to_list(args)
|
nested_statement = Tuple.to_list(args)
|
||||||
|
|
||||||
with {:ok, args} <-
|
with {:ok, args} <- hydrate_refs(List.wrap(nested_statement), context),
|
||||||
hydrate_refs(List.wrap(nested_statement), context),
|
|
||||||
refs <- list_refs(args),
|
refs <- list_refs(args),
|
||||||
:ok <-
|
:ok <- validate_refs(refs, context.root_resource, {function, nested_statement}),
|
||||||
validate_refs(
|
{:ok, function} <- Function.new(function_module, args) do
|
||||||
refs,
|
|
||||||
context.root_resource,
|
|
||||||
{function, nested_statement}
|
|
||||||
),
|
|
||||||
{:ok, function} <-
|
|
||||||
Function.new(
|
|
||||||
function_module,
|
|
||||||
args
|
|
||||||
) do
|
|
||||||
if is_nil(context.resource) ||
|
if is_nil(context.resource) ||
|
||||||
Ash.DataLayer.data_layer_can?(context.resource, {:filter_expr, function}) do
|
Ash.DataLayer.data_layer_can?(context.resource, {:filter_expr, function}) do
|
||||||
{:ok, BooleanExpression.optimized_new(:and, expression, function)}
|
{:ok, BooleanExpression.optimized_new(:and, expression, function)}
|
||||||
|
@ -2721,15 +2711,9 @@ defmodule Ash.Filter do
|
||||||
end
|
end
|
||||||
|
|
||||||
op_module = get_operator(field) && match?([_, _ | _], nested_statement) ->
|
op_module = get_operator(field) && match?([_, _ | _], nested_statement) ->
|
||||||
with {:ok, [left, right]} <-
|
with {:ok, [left, right]} <- hydrate_refs(nested_statement, context),
|
||||||
hydrate_refs(nested_statement, context),
|
|
||||||
refs <- list_refs([left, right]),
|
refs <- list_refs([left, right]),
|
||||||
:ok <-
|
:ok <- validate_refs(refs, context.root_resource, {field, nested_statement}),
|
||||||
validate_refs(
|
|
||||||
refs,
|
|
||||||
context.root_resource,
|
|
||||||
{field, nested_statement}
|
|
||||||
),
|
|
||||||
{:ok, operator} <- Operator.new(op_module, left, right) do
|
{:ok, operator} <- Operator.new(op_module, left, right) do
|
||||||
if is_boolean(operator) do
|
if is_boolean(operator) do
|
||||||
{:ok, BooleanExpression.optimized_new(:and, expression, operator)}
|
{:ok, BooleanExpression.optimized_new(:and, expression, operator)}
|
||||||
|
@ -2912,18 +2896,15 @@ defmodule Ash.Filter do
|
||||||
context
|
context
|
||||||
) do
|
) do
|
||||||
with :ok <- validate_datalayer_supports_nested_expressions(args, context.resource),
|
with :ok <- validate_datalayer_supports_nested_expressions(args, context.resource),
|
||||||
{:op, op_module} when not is_nil(op_module) <-
|
{:op, op_module} when not is_nil(op_module) <- {:op, get_operator(name)},
|
||||||
{:op, get_operator(name)},
|
|
||||||
context <-
|
context <-
|
||||||
Map.merge(context, %{
|
Map.merge(context, %{
|
||||||
resource: Ash.Resource.Info.related(context.resource, relationship_path),
|
resource: Ash.Resource.Info.related(context.resource, relationship_path),
|
||||||
relationship_path: []
|
relationship_path: []
|
||||||
}),
|
}),
|
||||||
{:ok, [left, right]} <-
|
{:ok, [left, right]} <- hydrate_refs(args, context),
|
||||||
hydrate_refs(args, context),
|
|
||||||
refs <- list_refs([left, right]),
|
refs <- list_refs([left, right]),
|
||||||
:ok <-
|
:ok <- validate_refs(refs, context.root_resource, call),
|
||||||
validate_refs(refs, context.root_resource, call),
|
|
||||||
{:ok, operator} <- Operator.new(op_module, left, right) do
|
{:ok, operator} <- Operator.new(op_module, left, right) do
|
||||||
if is_boolean(operator) do
|
if is_boolean(operator) do
|
||||||
{:ok, operator}
|
{:ok, operator}
|
||||||
|
@ -3062,17 +3043,12 @@ defmodule Ash.Filter do
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
with :ok <- validate_datalayer_supports_nested_expressions(args, context.resource),
|
with :ok <- validate_datalayer_supports_nested_expressions(args, context.resource),
|
||||||
{:ok, args} <-
|
{:ok, args} <- hydrate_refs(args, context),
|
||||||
hydrate_refs(args, context),
|
|
||||||
refs <- list_refs(args),
|
refs <- list_refs(args),
|
||||||
:ok <- validate_refs(refs, context.root_resource, call),
|
:ok <- validate_refs(refs, context.root_resource, call),
|
||||||
{:func, function_module} when not is_nil(function_module) <-
|
{:func, function_module} when not is_nil(function_module) <-
|
||||||
{:func, get_function(name, context.resource, context.public?)},
|
{:func, get_function(name, context.resource, context.public?)},
|
||||||
{:ok, function} <-
|
{:ok, function} <- Function.new(function_module, args) do
|
||||||
Function.new(
|
|
||||||
function_module,
|
|
||||||
args
|
|
||||||
) do
|
|
||||||
if Ash.Filter.TemplateHelpers.expr?(function) && !match?(%{__predicate__?: _}, function) do
|
if Ash.Filter.TemplateHelpers.expr?(function) && !match?(%{__predicate__?: _}, function) do
|
||||||
hydrate_refs(function, context)
|
hydrate_refs(function, context)
|
||||||
else
|
else
|
||||||
|
@ -3657,20 +3633,10 @@ defmodule Ash.Filter do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
with {:ok, args} <-
|
with {:ok, args} <- hydrate_refs([left, value], context),
|
||||||
hydrate_refs([left, value], context),
|
|
||||||
refs <- list_refs(args),
|
refs <- list_refs(args),
|
||||||
:ok <-
|
:ok <- validate_refs(refs, context.root_resource, {key, [left, value]}),
|
||||||
validate_refs(
|
{:ok, function} <- Function.new(function_module, args) do
|
||||||
refs,
|
|
||||||
context.root_resource,
|
|
||||||
{key, [left, value]}
|
|
||||||
),
|
|
||||||
{:ok, function} <-
|
|
||||||
Function.new(
|
|
||||||
function_module,
|
|
||||||
args
|
|
||||||
) do
|
|
||||||
if is_nil(context.resource) ||
|
if is_nil(context.resource) ||
|
||||||
Ash.DataLayer.data_layer_can?(
|
Ash.DataLayer.data_layer_can?(
|
||||||
context.resource,
|
context.resource,
|
||||||
|
@ -3709,15 +3675,9 @@ defmodule Ash.Filter do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
with {:ok, [left, right]} <-
|
with {:ok, [left, right]} <- hydrate_refs([left, value], context),
|
||||||
hydrate_refs([left, value], context),
|
|
||||||
refs <- list_refs([left, right]),
|
refs <- list_refs([left, right]),
|
||||||
:ok <-
|
:ok <- validate_refs(refs, context.root_resource, {attr, value}),
|
||||||
validate_refs(
|
|
||||||
refs,
|
|
||||||
context.root_resource,
|
|
||||||
{attr, value}
|
|
||||||
),
|
|
||||||
{:ok, operator} <- Operator.new(operator_module, left, right) do
|
{:ok, operator} <- Operator.new(operator_module, left, right) do
|
||||||
if is_boolean(operator) do
|
if is_boolean(operator) do
|
||||||
{:cont, {:ok, operator}}
|
{:cont, {:ok, operator}}
|
||||||
|
|
|
@ -675,8 +675,7 @@ defmodule Ash.Filter.Runtime do
|
||||||
unknown_on_unknown_refs?
|
unknown_on_unknown_refs?
|
||||||
) do
|
) do
|
||||||
with {:ok, args} <- resolve_exprs(args, record, parent, resource, unknown_on_unknown_refs?),
|
with {:ok, args} <- resolve_exprs(args, record, parent, resource, unknown_on_unknown_refs?),
|
||||||
{:args, args} when not is_nil(args) <-
|
{:args, args} when not is_nil(args) <- {:args, try_cast_arguments(mod.args(), args)},
|
||||||
{:args, try_cast_arguments(mod.args(), args)},
|
|
||||||
{:known, val} <-
|
{:known, val} <-
|
||||||
evaluate(%{pred | arguments: args}, record, parent, resource, unknown_on_unknown_refs?) do
|
evaluate(%{pred | arguments: args}, record, parent, resource, unknown_on_unknown_refs?) do
|
||||||
{:ok, val}
|
{:ok, val}
|
||||||
|
|
|
@ -209,10 +209,8 @@ defmodule Ash.Query.BooleanExpression do
|
||||||
end
|
end
|
||||||
|
|
||||||
%Eq{} = eq_op ->
|
%Eq{} = eq_op ->
|
||||||
with {:left, nil} <-
|
with {:left, nil} <- {:left, Ash.Filter.find(left, &simplify?(&1, eq_op), true, false)},
|
||||||
{:left, Ash.Filter.find(left, &simplify?(&1, eq_op), true, false)},
|
{:right, nil} <- {:right, Ash.Filter.find(right, &simplify?(&1, eq_op), true, false)} do
|
||||||
{:right, nil} <-
|
|
||||||
{:right, Ash.Filter.find(right, &simplify?(&1, eq_op), true, false)} do
|
|
||||||
do_new(:or, left_expr, eq_op)
|
do_new(:or, left_expr, eq_op)
|
||||||
else
|
else
|
||||||
{:left, _} ->
|
{:left, _} ->
|
||||||
|
@ -246,10 +244,8 @@ defmodule Ash.Query.BooleanExpression do
|
||||||
end
|
end
|
||||||
|
|
||||||
%Eq{} = eq_op ->
|
%Eq{} = eq_op ->
|
||||||
with {:left, nil} <-
|
with {:left, nil} <- {:left, Ash.Filter.find(left, &simplify?(&1, eq_op), false, true)},
|
||||||
{:left, Ash.Filter.find(left, &simplify?(&1, eq_op), false, true)},
|
{:right, nil} <- {:right, Ash.Filter.find(right, &simplify?(&1, eq_op), false, true)} do
|
||||||
{:right, nil} <-
|
|
||||||
{:right, Ash.Filter.find(right, &simplify?(&1, eq_op), false, true)} do
|
|
||||||
do_new(:and, left_expr, eq_op)
|
do_new(:and, left_expr, eq_op)
|
||||||
else
|
else
|
||||||
{:left, _} ->
|
{:left, _} ->
|
||||||
|
|
|
@ -2305,8 +2305,7 @@ defmodule Ash.Query do
|
||||||
query = to_query(query)
|
query = to_query(query)
|
||||||
|
|
||||||
with sanitized_statement <- List.wrap(sanitize_loads(statement)),
|
with sanitized_statement <- List.wrap(sanitize_loads(statement)),
|
||||||
:ok <-
|
:ok <- validate_load(query, sanitized_statement),
|
||||||
validate_load(query, sanitized_statement),
|
|
||||||
new_loads <- merge_load(query.load, sanitized_statement) do
|
new_loads <- merge_load(query.load, sanitized_statement) do
|
||||||
%{query | load: new_loads}
|
%{query | load: new_loads}
|
||||||
else
|
else
|
||||||
|
@ -2716,13 +2715,10 @@ defmodule Ash.Query do
|
||||||
query,
|
query,
|
||||||
Map.put(ash_query.context, :action, ash_query.action)
|
Map.put(ash_query.context, :action, ash_query.action)
|
||||||
),
|
),
|
||||||
{:ok, query} <-
|
{:ok, query} <- add_tenant(query, ash_query),
|
||||||
add_tenant(query, ash_query),
|
|
||||||
{:ok, query} <- Ash.DataLayer.select(query, ash_query.select, ash_query.resource),
|
{:ok, query} <- Ash.DataLayer.select(query, ash_query.select, ash_query.resource),
|
||||||
{:ok, query} <-
|
{:ok, query} <- Ash.DataLayer.sort(query, ash_query.sort, resource),
|
||||||
Ash.DataLayer.sort(query, ash_query.sort, resource),
|
{:ok, query} <- Ash.DataLayer.distinct_sort(query, ash_query.distinct_sort, resource),
|
||||||
{:ok, query} <-
|
|
||||||
Ash.DataLayer.distinct_sort(query, ash_query.distinct_sort, resource),
|
|
||||||
{:ok, query} <-
|
{:ok, query} <-
|
||||||
Ash.DataLayer.add_aggregates(
|
Ash.DataLayer.add_aggregates(
|
||||||
query,
|
query,
|
||||||
|
@ -2737,10 +2733,8 @@ defmodule Ash.Query do
|
||||||
ash_query.resource
|
ash_query.resource
|
||||||
),
|
),
|
||||||
{:ok, query} <- Ash.DataLayer.distinct(query, ash_query.distinct, resource),
|
{:ok, query} <- Ash.DataLayer.distinct(query, ash_query.distinct, resource),
|
||||||
{:ok, query} <-
|
{:ok, query} <- Ash.DataLayer.limit(query, ash_query.limit, resource),
|
||||||
Ash.DataLayer.limit(query, ash_query.limit, resource),
|
{:ok, query} <- Ash.DataLayer.offset(query, ash_query.offset, resource),
|
||||||
{:ok, query} <-
|
|
||||||
Ash.DataLayer.offset(query, ash_query.offset, resource),
|
|
||||||
{:ok, query} <- Ash.DataLayer.lock(query, ash_query.lock, resource),
|
{:ok, query} <- Ash.DataLayer.lock(query, ash_query.lock, resource),
|
||||||
{:ok, query} <- maybe_return_query(query, resource, opts) do
|
{:ok, query} <- maybe_return_query(query, resource, opts) do
|
||||||
if opts[:no_modify?] || !ash_query.action || !ash_query.action.modify_query do
|
if opts[:no_modify?] || !ash_query.action || !ash_query.action.modify_query do
|
||||||
|
|
|
@ -554,8 +554,7 @@ defmodule Ash.Type do
|
||||||
end
|
end
|
||||||
|
|
||||||
def cast_input(type, term, nil) do
|
def cast_input(type, term, nil) do
|
||||||
with {:ok, constraints} <-
|
with {:ok, constraints} <- Spark.OptionsHelpers.validate([], Ash.Type.constraints(type)),
|
||||||
Spark.OptionsHelpers.validate([], Ash.Type.constraints(type)),
|
|
||||||
{:ok, constraints} <- Ash.Type.init(type, constraints) do
|
{:ok, constraints} <- Ash.Type.init(type, constraints) do
|
||||||
cast_input(type, term, constraints)
|
cast_input(type, term, constraints)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue