Aurora.Uix.Integration.Connector (Aurora UIX v0.1.4-rc.6)

Copy Markdown

Defines the integration connector structure for backend implementations.

Represents the type of backend connector for crud operations and its associated crud_spec, enabling polymorphic dispatch across different integration backends (Ash Framework or Context-based implementations).

Key Features

  • Type-based backend identification (:ash or :ctx)
  • Flexible crud_spec storage for backend-specific configurations
  • Support for pattern matching on connector types

Key Constraints

  • Type must be one of: :ash, :ctx, or nil
  • Definition structure varies based on connector type

Summary

Functions

Creates a new Connector struct with the given crud_spec and type.

Types

t()

@type t() :: %Aurora.Uix.Integration.Connector{
  crud_spec: term(),
  type: :ash | :ctx | nil
}

Functions

new(crud_spec, type)

@spec new(term(), atom()) :: t()

Creates a new Connector struct with the given crud_spec and type.

Parameters

  • crud_spec (term()) - The backend-specific configuration or crud_spec data.
  • type (atom()) - The connector type (:ash or :ctx).

Returns

t() - A new %Connector{} struct.

Examples

iex> new(%CrudSpec{action: :read, resource: MyApp.Resources.MyResource}, :ash)
%Connector{type: :ash, crud_spec: %CrudSpec{action: :read, resource: MyApp.Resources.MyResource}}

iex> new(%CrudSpec{function_spec: &MyContext.list_users/1}, :ctx)
%Connector{type: :ctx, crud_spec: %CrudSpec{function_spec: &MyContext.list_users/1}}