ROM::Repository#transaction

Parsed documentation:
View on GitHub
Open a database transaction

@example commited transaction
  user = transaction do |t|
    create(changeset(name: 'Jane'))
  end

  user
  # => #<ROM::Struct::User id=1 name="Jane">

@example with a rollback
  user = transaction do |t|
    changeset(name: 'Jane').commit
    t.rollback!
  end

  user
  # nil

@example with automatic savepoints
  user = transaction(auto_savepoint: true) do
    create(changeset(name: 'Jane'))

    transaction do |t|
      update(changeset(name: 'John'))
      t.rollback!
    end
  end

  user
  # => #<ROM::Struct::User id=1 name="Jane">

@api public
Suggestions:
Please help! Open an issue on GitHub if this assessment is incorrect.