20 lines
390 B
Go
20 lines
390 B
Go
|
package middleware
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/ekzyis/magicwallet/server/router/context"
|
||
|
"github.com/labstack/echo/v4"
|
||
|
)
|
||
|
|
||
|
func DbGuard(hc context.Context) echo.MiddlewareFunc {
|
||
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||
|
return func(ec echo.Context) error {
|
||
|
if hc.Db != nil {
|
||
|
return next(ec)
|
||
|
}
|
||
|
return echo.NewHTTPError(http.StatusNotImplemented)
|
||
|
}
|
||
|
}
|
||
|
}
|