Aurora.Uix.Resource (Aurora UIX v0.1.0)

Manages comprehensive metadata configuration for schemas and their associated UI representations.

This module provides a flexible struct and utility functions for:

  • Defining schema-specific UI configurations
  • Managing dynamic field definitions
  • Supporting complex UI generation scenarios

Key features:

  • Supports custom field configurations
  • Allows runtime modification of schema metadata
  • Integrates with other Aurora.Uix parsing components

Summary

Functions

Updates an existing resource struct with the given attributes.

Creates a new Aurora.Uix.Resource struct with the given attributes.

Types

t()

@type t() :: %Aurora.Uix.Resource{
  context: module() | nil,
  fields: map() | list(),
  fields_order: list(),
  inner_elements: list(),
  name: atom(),
  opts: keyword(),
  schema: module()
}

Functions

change(resource_config, attrs)

@spec change(t(), map() | keyword()) :: t()

Updates an existing resource struct with the given attributes.

Parameters

  • resource_config (Aurora.Uix.Resource.t()) - Existing resource struct to update.
  • attrs (map() | keyword()) - Attributes to update with :name, :schema, :context, and :fields keys.

Returns

Aurora.Uix.Resource.t() - Updated resource struct.

Examples

resource = Aurora.Uix.Resource.new(name: :user)
Aurora.Uix.Resource.change(resource, %{schema: MyApp.User})
# => %Aurora.Uix.Resource{name: :user, schema: MyApp.User, ...}

delete(struct, key)

get(struct, key, default \\ nil)

new(attrs \\ %{})

@spec new(map() | keyword()) :: t()

Creates a new Aurora.Uix.Resource struct with the given attributes.

Parameters

  • attrs (map() | keyword()) - Initial attributes with :name, :schema, :context, and :fields keys.

Returns

Aurora.Uix.Resource.t() - A new resource struct.

Examples

Aurora.Uix.Resource.new(name: :user, schema: MyApp.User)
# => %Aurora.Uix.Resource{name: :user, schema: MyApp.User, ...}

put(struct, key, val)