View Source AshPyro.Extensions.Resource.Info (AshPyro v0.0.0)

Helpers to introspect the AshPyro.Extensions.Resource Ash extension. Intended for use in components that automatically build UI from resource configuration.

Summary

Functions

Returns the data table defined in the AshPyro.Extensions.Resource extension for the given action.

Same as &data_table_for2, but raises if not found.

Returns the form fields defined in the AshPyro.Extensions.Resource extension for the given action.

Same as &form_for2, but raises if not found.

Returns the page defined in the AshPyro.Extensions.Resource extension for the given page name.

Same as &page_for2, but raises if not found.

Functions

Link to this function

data_table_for(resource, action_name)

View Source
@spec data_table_for(Ash.Resource.t(), atom()) ::
  [AshPyro.Extensions.Resource.DataTable] | nil

Returns the data table defined in the AshPyro.Extensions.Resource extension for the given action.

Examples

iex> data_table_for(AshPyro.Extensions.Resource.InfoTest.User, :list) |> Map.get(:name)
:list
Link to this function

data_table_for!(resource, action_name)

View Source
@spec data_table_for!(Ash.Resource.t(), atom()) :: [
  AshPyro.Extensions.Resource.DataTable
]

Same as &data_table_for2, but raises if not found.

Link to this function

form_for(resource, action_name)

View Source

Returns the form fields defined in the AshPyro.Extensions.Resource extension for the given action.

Examples

iex> form_for(AshPyro.Extensions.Resource.InfoTest.User, :create) |> Map.get(:fields) |> Enum.map(& &1.name)
[:primary, :authorization, :friendships, :notes]
Link to this function

form_for!(resource, action_name)

View Source

Same as &form_for2, but raises if not found.

Link to this function

page_for(resource, page_name)

View Source
@spec page_for(Ash.Resource.t(), atom()) ::
  AshPyro.Extensions.Resource.LiveView.Page | nil

Returns the page defined in the AshPyro.Extensions.Resource extension for the given page name.

Examples

iex> page_for(AshPyro.Extensions.Resource.InfoTest.User, :companies) |> Map.get(:name)
:companies
Link to this function

page_for!(resource, page_name)

View Source
@spec page_for!(Ash.Resource.t(), atom()) :: AshPyro.Extensions.Resource.LiveView.Page

Same as &page_for2, but raises if not found.