You've already forked reloading-manager
No changes made
This commit is contained in:
25
backend/database/middleware.go
Normal file
25
backend/database/middleware.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type CustomContext struct {
|
||||
echo.Context
|
||||
Db *Database
|
||||
}
|
||||
|
||||
func CreateDatabaseMiddleware() echo.MiddlewareFunc {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
cc := &CustomContext{
|
||||
Context: c,
|
||||
Db: GetNewDatabase(),
|
||||
}
|
||||
|
||||
res := next(cc)
|
||||
|
||||
return res
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user