Bloccs.Effects.DB.Mock (bloccs v0.10.0)

Copy Markdown View Source

Mock DB backend. Refuses out-of-scope table actions. Records every successful insert for test introspection via inserts/0, and serves reads (get/3 / all/3 / one/3) from that same in-memory log.

Test/dev backend (the default). Its store is an Agent started lazily on first use and is NOT supervised — fine for tests, not a production process. Use Bloccs.Effects.DB.Ecto in production.

Reads return rows as string-keyed maps (the same contract as DB.Ecto), even though inserts may use atom keys — so a node's read logic is backend-agnostic.

Summary

Functions

inserts()

@spec inserts() :: [{atom() | String.t(), map()}]

reset()

@spec reset() :: :ok