mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Add workaround for crystal-lang/crystal#9483 (#160)
* Add workaround for crystal-lang/crystal#9483 * Update src/db/begin_transaction.cr Co-authored-by: Johannes Müller <straightshoota@gmail.com> Co-authored-by: Johannes Müller <straightshoota@gmail.com>
This commit is contained in:
parent
d829b07b01
commit
27ade07359
1 changed files with 3 additions and 1 deletions
|
@ -13,7 +13,9 @@ module DB
|
|||
# can be called explicitly.
|
||||
# Returns the value of the block.
|
||||
def transaction(& : Transaction -> T) : T? forall T
|
||||
tx = begin_transaction
|
||||
# TODO: Cast to workaround crystal-lang/crystal#9483
|
||||
# begin_transaction returns a Tx where Tx < Transaction
|
||||
tx = begin_transaction.as(Transaction)
|
||||
begin
|
||||
res = yield tx
|
||||
rescue DB::Rollback
|
||||
|
|
Loading…
Reference in a new issue