Last active
March 11, 2021 08:54
-
-
Save Reasno/ca5bd44c49690a203058a36dd71eaada to your computer and use it in GitHub Desktop.
Converts a Go-Kit middleware to Kratos middleware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util | |
import ( | |
"github.com/go-kit/kit/endpoint" | |
"github.com/go-kratos/kratos/v2/middleware" | |
) | |
// Kratosify Converts a Go-Kit middleware to Kratos middleware | |
func Kratosify(kitmw endpoint.Middleware) middleware.Middleware { | |
return func(handler middleware.Handler) middleware.Handler { | |
return middleware.Handler(kitmw(endpoint.Endpoint(handler))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment