1 files changed, 0 insertions(+), 19 deletions(-)
D database/middleware.go
D database/middleware.go => database/middleware.go +0 -19
@@ 1,19 0,0 @@
-package database
-
-import (
- "github.com/labstack/echo/v4"
-)
-
-// DBTransactionMiddleware will commit a transaction at the end of a request cycle
-// Should be placed as high up in the cycle as possible.
-func DBTransactionMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
- res := next(c)
- db := ForContext(c.Request().Context())
- db.EnableCommit()
- if err := db.CommitTx(); err != nil {
- return err
- }
- return res
- }
-}