Ash.CodeInterface (ash v3.11.1)

View Source

Used to define the functions of a code interface for a resource.

Summary

Functions

can?(params, opts, actor, subject, action_name, interface_name)

define_interface(domain, resource, definitions \\ nil)

(macro)

Defines the code interface for a given resource + domain combination in the current module. For example:

defmodule MyApp.Accounting do
  require Ash.CodeInterface

  Ash.CodeInterface.define_interface(MyApp.Accounting, MyApp.Accounting.Transaction)
  Ash.CodeInterface.define_interface(MyApp.Accounting, MyApp.Accounting.Account)
  Ash.CodeInterface.define_interface(MyApp.Accounting, MyApp.Accounting.Invoice)
end

params_and_opts(params_or_opts, maybe_opts, post_process_opts_fn)

@spec params_and_opts(
  params_or_opts :: map() | [map()] | keyword(),
  keyword(),
  (keyword() -> keyword())
) :: {params :: map() | [map()], opts :: keyword()}

See params_and_opts/2.

Adds a post process function that can takes the opts and can further process, validate, or transform them.

resolve_action_subject(opts, params, domain, resource, action_name, custom_input_errors)

resolve_create_subject(opts, params, custom_input_errors, domain, resource, action_name)

resolve_params_and_opts(params_or_opts, opts, default_options, interface_options, arg_params, exclude_inputs, resource, interface_name, arity, custom_inputs, filter_params)

resolve_read_subject(opts, domain, resource, custom_input_errors)