Skip to content

Commit

Permalink
Update transactions docs + changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
System-Glitch committed Jun 13, 2024
1 parent c7686e4 commit c8d03ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/advanced/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,8 @@ func (s *Service) Register(ctx context.Context, user *dto.RegisterUser) (*dto.Us

The system gracefully handles nested transactions. If a service starts a transaction (either with `Transaction()` or manually with `Begin()`) using a context that already contains a transaction, the session will retrieve this database instance automatically and use it as a starting point for the creation of a nested transaction.

Nested transactions work with savepoints. If the nested transaction returns an error, it will be rolled back to its starting point, leaving the root transaction intact. It is still recommended to rollback the root transaction by simply bringing the returned error up the stack as usual.

The use of savepoints in nested transactions can be disabled by setting Gorm's `DisableNestedTransaction` setting to `true`.

This way, services don't have to worry about operating in a potential transaction from inside another dependent service. Everything will just work as units that can be used anywhere.
8 changes: 8 additions & 0 deletions src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ You can also see the changelog on [Github](https://github.com/go-goyave/goyave/r
You can be notified of new releases by enabling notifications on Github or by joining our [Discord](https://discord.gg/mfemDMc).
:::


# v5.0.1

- `util/httputil`: fixed a race condition when initializing the quality value regex
- `util/session`: improved support for nested transactions

# v5.0.0

[[toc]]

## Introduction
Expand Down

0 comments on commit c8d03ca

Please sign in to comment.