cockroachdb / cockroachdb/cockroach-go

Wrapped transaction occurring when using GORM?

Open
#188 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
169
Forks
78
PR merge metrics
No merged PRs in 30d

Description

The GORM library already uses transactions by default for write operations: https://gorm.io/docs/transactions.html.

Does this mean that when using `crdbgorm.ExecuteTx` the GORM transaction is being wrapped in the CRDB transaction?

If that is true, GORM allows for disabling that behavior with the `gorm.Config.SkipDefaultTransaction` field, so perhaps it should be encouraged when using `crdbgorm`, or a new `crdbgorm.Execute` method could be added that does not use a transaction.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the issue's GORM transactions documentation link and inspect how crdbgorm.ExecuteTx is used. Compare that behavior with gorm.Config.SkipDefaultTransaction, then determine whether the desired outcome is guidance for users or a separate crdbgorm.Execute method; done means the transaction behavior and recommended approach are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.