module DB::BeginTransaction

Direct including types

Defined in:

db/begin_transaction.cr

Instance Method Summary

Instance Method Detail

abstract def begin_transaction : Transaction #

Creates a transaction from the current context. If is expected that either Transaction#commit or Transaction#rollback are called explicitly to release the context.


[View source]
def transaction(&) #

yields a transaction from the current context. Query the database through Transaction#connection object. If an exception is thrown within the block a rollback is performed. The exception thrown is bubbled unless it is a DB::Rollback. From the yielded object Transaction#commit or Transaction#rollback can be called explicitly.


[View source]