Skip to content

Commit

Permalink
Merge pull request #3 from knwoop/fix-dome
Browse files Browse the repository at this point in the history
fix readme sample and go version
  • Loading branch information
knwoop authored Oct 16, 2024
2 parents e1001c1 + 28a5cae commit 63a6cc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ The RunInTransaction function allows you to execute a function inside an existin
If no transaction is present in the context, it creates a new transaction.

``` go
err := client.RunInTransaction(context.Background(), func(ctx context.Context, txn *Transaction) error {
// Perform operations with or without a transaction.
if err := client.RunInTransaction(ctx, func(ctx context.Context, txn *Transaction) error {
_, err := tx.ExecContext(ctx, "UPDATE example SET col = ? WHERE id = ?", "new_value", 1)
return err
})
if err != nil {
// error handling
}); err != nil {
// error handling
}
```

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/knwoop/goransaction

go 1.20.0
go 1.23

0 comments on commit 63a6cc7

Please sign in to comment.