Bloccs.Effects.DB behaviour (bloccs v0.1.0)

Copy Markdown View Source

DB effect facade + backend behaviour.

Nodes call Bloccs.Effects.DB.insert/3 against ctx.effects.db; the facade dispatches to the bound backend (DB.Mock in tests, DB.Ecto against a real repo in production). Scope enforcement ("table:action") is the backend's job. Backends @behaviour Bloccs.Effects.DB.

Summary

Functions

Insert attrs into table through the bound DB backend.

Types

attrs()

@type attrs() :: keyword() | map()

cap()

@type cap() :: struct()

declaration()

@type declaration() :: %{allow: [String.t()]}

table()

@type table() :: atom() | String.t()

Callbacks

insert(cap, table, attrs)

@callback insert(cap(), table(), attrs()) :: {:ok, map()} | {:error, term()}

new(declaration)

@callback new(declaration()) :: cap()

Functions

insert(cap, table, attrs)

@spec insert(cap(), table(), attrs()) :: {:ok, map()} | {:error, term()}

Insert attrs into table through the bound DB backend.