feat(middleware): update middleware

This commit is contained in:
bandl 2021-09-29 21:21:45 +08:00
parent ae5a0531d8
commit 57bdec3c1d
5 changed files with 10 additions and 10 deletions

View File

@ -10,9 +10,9 @@ import (
mapKey "gitee.com/timedb/wheatCache/middleware/map-key"
)
func GetMiddlewareMap() map[string]middleware.MiddlewareInterface {
func GetMiddlewareMap() map[string]middleware.MiddleToolsInterface {
return map[string]middleware.MiddlewareInterface{
return map[string]middleware.MiddleToolsInterface{
"logMiddle": logMiddle.NewMiddleware(),
"mapKey": mapKey.NewMiddleware(),

View File

@ -11,9 +11,9 @@ import (
)
func GetMiddlewareMap() map[string]middleware.MiddlewareInterface {
func GetMiddlewareMap() map[string]middleware.MiddleToolsInterface {
return map[string]middleware.MiddlewareInterface{
return map[string]middleware.MiddleToolsInterface{
{%for dir in dirs %}
"{{dir[0]}}":{{dir[0]}}.NewMiddleware(),
{%- endfor%}

View File

@ -1,6 +1,6 @@
package middleware
type MiddlewareInterface interface {
type MiddleToolsInterface interface {
Init()
Exat(interface{}) (interface{}, error)
Exec(interface{}) (interface{}, error)
}

View File

@ -12,11 +12,11 @@ type A struct {
func (i *A) Init() {
}
func (i *A) Exat(interface{}) (interface{}, error) {
func (i *A) Exec(interface{}) (interface{}, error) {
fmt.Println(1)
return nil, nil
}
func NewMiddleware() middleware.MiddlewareInterface {
func NewMiddleware() middleware.MiddleToolsInterface {
return &A{}
}

View File

@ -12,11 +12,11 @@ type ABB struct {
func (i *ABB) Init() {
}
func (i *ABB) Exat(interface{}) (interface{}, error) {
func (i *ABB) Exec(interface{}) (interface{}, error) {
fmt.Println(1)
return nil, nil
}
func NewMiddleware() middleware.MiddlewareInterface {
func NewMiddleware() middleware.MiddleToolsInterface {
return &ABB{}
}