Ash.CodeInterface (ash v3.4.68)

View Source

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

Summary

Functions

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

Functions

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.