Lavash.Read (Lavash v0.3.0-rc.0)

Copy Markdown View Source

A read step that loads an Ash resource.

Supports two modes:

Get by ID (single record)

read :product, Product do
  id state(:product_id)
end

Query with auto-mapped arguments

# Auto-maps state fields to action arguments by name
read :products, Product, :list

# With explicit overrides
read :products, Product, :list do
  argument :category, transform: &(if &1 == "", do: nil, else: &1)
end

Action arguments are auto-wired to matching state fields. Use argument entities to override the source or apply transforms.