Skip to content

Transactions

The hand written InTx above passes the *sql.Tx explicitly. The sql module (github.com/dygoframework/dygo/sql) takes the other route: db.Tx(ctx, fn) puts the transaction in ctx, and every query that gets that ctx joins it, nested calls become savepoints, and sql.Detach(ctx) gives goroutines a context without it. Pick one style per app.