~netlandish/gobwebs

f990d2a4e007c71b8d42730ade7beca3df71c49d — Peter Sanchez 1 year, 9 months ago 6c9ac3b
Removing bad database middleware.
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
	}
}