Golang, Transactions, Sql, Closures Functions, Acid.
scenario service layer shouldn’t be responsible for that. The database layer needs to trust the service layer that it commits or rollbacks an open transaction. Else it creates a leak. Here comes closures. Lets see how the code look with closures. Service Layer Database Layer In the second approach