DDD.InMemoryRepository (vicander v0.1.1)

Copy Markdown View Source

Generic in-memory repository adapter. Ideal for tests.

Usage

defmodule MyApp.Test.OrderRepository do
  use DDD.InMemoryRepository,
    port: MyApp.OrderRepository
end

Entities are stored under DDD.Identity.key/1: the identity field's value, or the identity string for a composite identity (the argument of find_by_id/1).

{:ok, _} = MyApp.Test.OrderRepository.start_link()