skuld_repo

Repo > | Umbrella →

Ecto integration for Skuld — an effectful dispatch facade that makes database calls feel like any other effect, with swappable backends for testing. Write once against the effectful interface; swap InMemory in tests, Ecto in production.

What's included

Installation

def deps do
[
{:skuld_repo, "~> 0.32"}
]
end

Example: test-first with InMemory

# Production
comp do
user <- Repo.insert!(%User{name: "Alice"})
found <- Repo.get(User, user.id)
found
end
|> Port.with_handler(%{Repo.Effectful => MyApp.Repo.Ecto})
|> Throw.with_handler()
|> Comp.run!()
# Test — same code, zero setup beyond the handler
comp
|> Port.with_handler(%{Repo.Effectful => Repo.InMemory.new()})
|> Throw.with_handler()
|> Comp.run!()

Further reading

See the architecture guide for how this fits into the Skuld ecosystem.


Repo > | Umbrella →