wheat-cache/storage/server/server.go

61 lines
995 B
Go

package server
import (
context "context"
"errors"
"gitee.com/timedb/wheatCache/pkg/proto"
"gitee.com/timedb/wheatCache/pkg/structure/stringx"
)
type server struct {
}
func NewServer() proto.CommServerServer {
ser := &server{}
return ser
}
func (s *server) Get(
cxt context.Context,
req *proto.GetRequest,
) (*proto.CommendResponse, error) {
var value interface{}
switch value.(type) {
case *stringx.StringX:
default:
return nil, errors.New("awdwd")
}
result, err := value.(*stringx.StringX).Get(req)
if err != nil {
return nil, err
}
return &proto.CommendResponse{
Result: result,
}, nil
}
func (s *server) Set(
ctx context.Context,
req *proto.SetRequest,
) (*proto.CommendResponse, error) {
var value interface{}
switch value.(type) {
case *stringx.StringX:
default:
return nil, errors.New("awdwd")
}
result, err := value.(*stringx.StringX).Set(req)
if err != nil {
return nil, err
}
return &proto.CommendResponse{
Result: result,
}, nil
}