Aurora. Uix. Integration. Ctx. ContextParserDefaults
(Aurora UIX v0.1.4-rc.4)
Copy Markdown
Default value resolution for Context-based resource configurations.
Automatically discovers and configures Context-based function references for CRUD operations by introspecting context modules and matching function names based on naming conventions. Creates Connector structures wrapping CrudSpec configurations.
Key Features
- Automatic function discovery from context modules
- Convention-based function name matching (e.g.,
list_users,get_user) - Fallback to alternative function names (e.g.,
get_user!) - Integration with Connector and CrudSpec structures
- Support for all standard CRUD operations
Key Constraints
- Requires context module to be available
- Function discovery based on naming conventions
- Returns placeholder function when no valid function is found
- Expected function arities must match operation requirements
Implemented Options
:list_function- Lists all resources:list_function_paginated- Lists resources with pagination:get_function- Retrieves a single resource:delete_function- Deletes a resource:create_function- Creates a new resource:update_function- Updates an existing resource:change_function- Creates a changeset for updates:new_function- Creates a new resource struct
Summary
Functions
Resolves default function references for Context-based operations.
Functions
@spec option_value(map(), map(), keyword(), atom()) :: Aurora.Uix.Integration.Connector.t()
Resolves default function references for Context-based operations.
Discovers functions from the context module using naming conventions, selecting the first available match from a list of candidate names.
Parameters
parsed_opts(map()) - Map containing::source(binary()) - The source name (e.g., "users").:module(binary()) - The module name (e.g., "user").
resource_config(map()) - Map with::context(module()) - The context module to introspect.
auix_action_name(atom()) - The Aurora UIX action key (e.g.,:list_function,:get_function).
Returns
Connector.t() - A %Connector{} struct wrapping the %CrudSpec{} and function reference.
Examples
iex> default_value(%{source: "users", module: "user"}, %{context: MyApp.Accounts},
...> :list_function)
%Connector{type: :ctx, crud_spec: %CrudSpec{function_spec: &MyApp.Accounts.list_users/1}}
iex> default_value(%{module: "post"}, %{context: MyApp.Blog}, :get_function)
%Connector{type: :ctx, crud_spec: %CrudSpec{function_spec: &MyApp.Blog.get_post/2}}