forked from p93542168/wheat-cache
awd
This commit is contained in:
parent
70319ae2b1
commit
d4a73b93d3
|
@ -5,4 +5,4 @@ env: 'dev'
|
|||
storage:
|
||||
host: '127.0.0.1'
|
||||
port: 5890
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
|
@ -2,5 +2,5 @@ package middleware
|
|||
|
||||
type MiddlewareInterface interface {
|
||||
Init()
|
||||
Exet(interface{}) (interface{}, error)
|
||||
Exat(interface{}) (interface{}, error)
|
||||
}
|
||||
|
|
|
@ -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{}
|
||||
}
|
|
@ -1 +1,7 @@
|
|||
package middle
|
||||
|
||||
import middleConf "gitee.com/timedb/wheatCache/middleware/config"
|
||||
|
||||
func init() {
|
||||
middleConf.GetMiddlewareMap()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue