API Reference DustEcto v#0.1.1

Copy Markdown View Source

Modules

Ecto-shaped facade over Dust — DustEcto.Schema plus DustEcto.Repo, designed to feel like the parts of Ecto.Schema and Ecto.Repo that map cleanly onto Dust's flat KV model.

Single error struct returned from DustEcto.Repo when transport failures or server errors occur. Validation errors return {:error, %Ecto.Changeset{}} instead — that path is unchanged.

Phoenix.PubSub bridge for DustEcto.Repo subscriptions. Turns the four-step "supervise Dust, configure facade, subscribe in mount, don't block in the callback" recipe into a one-liner that's safe to call from a LiveView.

One broadcaster process per {schema, pubsub, topic} triple. Holds a single DustEcto.Repo.subscribe/2 registration whose callback broadcasts every event through Phoenix.PubSub on topic.

Ecto-shaped facade over the active DustEcto.Transport. Functions mirror the parts of Ecto.Repo that map cleanly onto Dust's flat KV model: all/1, get/2 + get!/2, stream/1, exists?/2, plus insert/1, update/1, delete/1 + delete/2, and delete_all/1.

use DustEcto.Schema, prefix: ["links"], required: [:slug, :title] pairs an Ecto.Schema (embedded) with a Dust prefix and the slug field used as the per-record namespace key.

Behaviour every dustlayer_ecto transport adapter implements. Two implementations ship: DustEcto.Transport.SDK (recommended, uses Phoenix Channels via :dustlayer) and DustEcto.Transport.HTTP (Req-based, stateless, no realtime).

Stateless HTTP transport — Req against the Dust REST API. Suitable for one-shot scripts, release tasks, and contexts where the WS supervisor isn't running. No realtime: subscribe/3 returns {:error, :not_supported}.

WebSocket-backed transport — delegates every call to the configured Dust facade module (default Dust). Uses the SDK pre-work landed in the same monorepo: sync write semantics on every op, subtree-aware reads, and :committed subscription mode for exactly-once delivery.