This commit is contained in:
bandl 2021-09-27 09:52:27 +08:00
parent 70319ae2b1
commit d4a73b93d3
5 changed files with 44 additions and 2 deletions

View File

@ -5,4 +5,4 @@ env: 'dev'
storage:
host: '127.0.0.1'
port: 5890

View File

@ -0,0 +1,14 @@
package config
import (
"gitee.com/timedb/wheatCache/middleware"
logMiddle "gitee.com/timedb/wheatCache/middleware/log-middle"
)
func GetMiddlewareMap() map[string]middleware.MiddlewareInterface {
logMiddlewareCase := logMiddle.NewMiddleware()
return map[string]middleware.MiddlewareInterface{
"logMiddlewareCase": logMiddlewareCase,
}
}

View File

@ -2,5 +2,5 @@ package middleware
type MiddlewareInterface interface {
Init()
Exet(interface{}) (interface{}, error)
Exat(interface{}) (interface{}, error)
}

View File

@ -0,0 +1,22 @@
package log_middle
import (
"fmt"
"gitee.com/timedb/wheatCache/middleware"
)
type A struct {
}
func (i *A) Init() {
}
func (i *A) Exat(interface{}) (interface{}, error) {
fmt.Println(1)
return nil, nil
}
func NewMiddleware() middleware.MiddlewareInterface {
return &A{}
}

View File

@ -1 +1,7 @@
package middle
import middleConf "gitee.com/timedb/wheatCache/middleware/config"
func init() {
middleConf.GetMiddlewareMap()
}