Run a closure inside a transaction. Commits on success, rolls back on any exception, then re-throws so the caller can react. Avoids the bug-prone copy-paste of begin/commit/rollBack.
Wrap related changes in a transaction so they commit or roll back together. Isolation levels trade consistency for concurrency — pick the weakest one that meets your correctness needs.
Wrap your transaction in a function that commits on success and rolls back on error or panic. Drop-in: pass any `func(*sql.Tx) error` and forget about manual cleanup.