MobAsh.Info (mob_ash v0.1.1)

Copy Markdown View Source

Pure Ash-introspection helpers the generator and the shared screens build on. Kept public + side-effect free so the resource→UI mapping is unit- testable without a device (and without mob_dev).

Summary

Functions

Public attributes to DISPLAY, primary key + autogenerated timestamps last.

Stringified value of field on record (nil-safe).

Public, writable, non-generated attributes — what the create form edits. Only types a <TextField> can carry for now (string-castable scalars).

Route segment for a resource: MyApp.Blog.Post"post".

One-line label for a record row: the first non-pk display attribute's value (fallback: the primary key).

Human title for a resource: MyApp.Blog.Post"Post".

Functions

display_attributes(resource)

@spec display_attributes(module()) :: [atom()]

Public attributes to DISPLAY, primary key + autogenerated timestamps last.

field_value(record, field)

@spec field_value(
  struct(),
  atom()
) :: String.t()

Stringified value of field on record (nil-safe).

form_attributes(resource)

@spec form_attributes(module()) :: [atom()]

Public, writable, non-generated attributes — what the create form edits. Only types a <TextField> can carry for now (string-castable scalars).

route_segment(resource)

@spec route_segment(module()) :: String.t()

Route segment for a resource: MyApp.Blog.Post"post".

row_label(resource, record)

@spec row_label(
  module(),
  struct()
) :: String.t()

One-line label for a record row: the first non-pk display attribute's value (fallback: the primary key).

title(resource)

@spec title(module()) :: String.t()

Human title for a resource: MyApp.Blog.Post"Post".