forked from p93542168/wheat-cache
34 lines
763 B
Plaintext
34 lines
763 B
Plaintext
// Code generated by gen-struct. DO NOT EDIT.
|
|
// make gen-service generated
|
|
package dao
|
|
|
|
import (
|
|
"gitee.com/wheat-os/wheatCache/pkg/errorx"
|
|
"gitee.com/wheat-os/wheatCache/pkg/lru"
|
|
"gitee.com/wheat-os/wheatCache/pkg/proto"
|
|
protobuf "google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
type Dao struct {
|
|
lru lru.CacheInterface
|
|
}
|
|
|
|
func NewDao(lru lru.CacheInterface) Interface {
|
|
return &Dao{
|
|
lru: lru,
|
|
}
|
|
}
|
|
|
|
// 执行 msg
|
|
func (d *Dao) ExecMessage(message protobuf.Message) error {
|
|
switch req := message.(type) {
|
|
{%for key in keys %}
|
|
case *proto.{{key.method}}Request:
|
|
_, err := d.{{key.method}}({% for req in key.option %} req.{{req[0]}}, {% endfor %})
|
|
return err
|
|
{%- endfor %}
|
|
default:
|
|
return errorx.New("The type that is not registered exec err")
|
|
}
|
|
}
|