AshPhoenixGenApi.Resource.EffectiveField (ash_phoenix_gen_api v1.0.3)

Copy Markdown View Source

A macro that generates common effective_* functions for configuration structs.

Both ActionConfig and MfaConfig share the same nil-fallback pattern for resolving effective field values. This macro generates those functions to avoid duplication.

Usage

defmodule MyConfig do
  use AshPhoenixGenApi.Resource.EffectiveField
  # ... struct and type definitions, unique functions, etc.
end

Generated Functions

The following effective_* functions are generated, each returning the struct's field value when set, or the provided default when nil:

  • effective_timeout/2
  • effective_response_type/2
  • effective_request_info/2
  • effective_check_permission/2
  • effective_permission_callback/2
  • effective_choose_node_mode/2
  • effective_nodes/2
  • effective_retry/2
  • effective_version/2

Additionally, these shared helper functions are generated:

  • has_explicit_arg_types?/1
  • has_explicit_arg_orders?/1
  • enabled?/1