EctoIsolator (ecto_isolator v0.1.0)

Copy Markdown View Source

Detects configured non-atomic operations while the current process is inside an Ecto transaction.

Summary

Functions

Checks whether an adapter action is allowed in the current process.

Returns true when any configured repo reports an active transaction.

Functions

check!(adapter, action, opts \\ [])

Checks whether an adapter action is allowed in the current process.

When any configured repo is in a transaction, the offense is handled according to the active mode:

  • :raise - raise EctoIsolator.Error
  • :log - write a warning and continue
  • :collect - record the offense for later assertion

with_mode(mode, fun)

within_transaction?(repos \\ Config.repos())

Returns true when any configured repo reports an active transaction.