Search documentation of ash

# Ash.CodeInterface (ash v3.4.71)

View Source

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

# Summary

## Functions

define_interface(domain, resource, definitions \\ nil)

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

params_and_opts(params_or_opts, maybe_opts, post_process_opts_fn)

See `params_and_opts/2`.

# 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.