Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce DB#ExecTx() method #63

Merged
merged 1 commit into from
Sep 24, 2024
Merged

Introduce DB#ExecTx() method #63

merged 1 commit into from
Sep 24, 2024

Conversation

yhabteab
Copy link
Member

@yhabteab yhabteab commented Aug 14, 2024

Introduces a DB#ExecTx() method on the DB receiver (cherry-picked from #18)

@yhabteab yhabteab added the enhancement New feature or request label Aug 14, 2024
@yhabteab yhabteab self-assigned this Aug 14, 2024
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Aug 14, 2024
@yhabteab yhabteab requested review from lippserd and oxzi August 14, 2024 13:52
database/db.go Outdated Show resolved Hide resolved
@yhabteab yhabteab requested a review from oxzi August 14, 2024 15:04
oxzi
oxzi previously approved these changes Aug 15, 2024
database/db.go Outdated Show resolved Hide resolved
database/db.go Outdated Show resolved Hide resolved
database/db.go Show resolved Hide resolved
database/db.go Outdated Show resolved Hide resolved
@yhabteab yhabteab requested review from lippserd and oxzi September 17, 2024 14:25
@yhabteab yhabteab changed the title Introduce DB#RunInTx() method Introduce DB#ExecTx() method Sep 18, 2024
@yhabteab
Copy link
Member Author

Just fixed the outdated commit message which was referring to the now renamed method DB#RunInTx.

database/db.go Outdated
func (db *DB) ExecTx(ctx context.Context, fn func(context.Context, *sqlx.Tx) error) error {
tx, err := db.BeginTxx(ctx, nil)
if err != nil {
return errors.Wrap(err, "cannot start transaction")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be pedantic but we're using can't instead of cannot everywhere. Same for the other error message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite ironic that we have replaced all such abbreviations in Icinga Notifications :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that :). If we want to use more formal error messages, I have no problem with that. However, we should then change all error messages in the lib.

database/db.go Outdated Show resolved Hide resolved
@lippserd lippserd added this to the 0.4.0 milestone Sep 19, 2024
@yhabteab
Copy link
Member Author

@oxzi do you want to look over the changes again since you previously approved it?

@lippserd lippserd merged commit 876ee1a into main Sep 24, 2024
15 checks passed
@lippserd lippserd deleted the run-in-tx-method branch September 24, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants