forked from p93542168/wheat-cache
feat(middleware): update middleware
This commit is contained in:
parent
ae5a0531d8
commit
57bdec3c1d
|
@ -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(),
|
||||
|
|
|
@ -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%}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package middleware
|
||||
|
||||
type MiddlewareInterface interface {
|
||||
type MiddleToolsInterface interface {
|
||||
Init()
|
||||
Exat(interface{}) (interface{}, error)
|
||||
Exec(interface{}) (interface{}, error)
|
||||
}
|
||||
|
|
|
@ -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{}
|
||||
}
|
||||
|
|
|
@ -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{}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue