65 lines
2.0 KiB
Go
65 lines
2.0 KiB
Go
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
|
// protoc-gen-go-micro version: v4.0.0
|
|
// source: service.proto
|
|
|
|
package servicepb
|
|
|
|
import (
|
|
context "context"
|
|
proto "go.unistack.org/micro-config-service/v4/proto"
|
|
client "go.unistack.org/micro/v4/client"
|
|
server "go.unistack.org/micro/v4/server"
|
|
)
|
|
|
|
type configServiceClient struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewConfigServiceClient(name string, c client.Client) ConfigServiceClient {
|
|
return &configServiceClient{c: c, name: name}
|
|
}
|
|
|
|
func (c *configServiceClient) Load(ctx context.Context, req *proto.LoadRequest, opts ...client.CallOption) (*proto.LoadResponse, error) {
|
|
rsp := &proto.LoadResponse{}
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "ConfigService.Load", req), rsp, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rsp, nil
|
|
}
|
|
|
|
func (c *configServiceClient) Save(ctx context.Context, req *proto.SaveRequest, opts ...client.CallOption) (*proto.SaveResponse, error) {
|
|
rsp := &proto.SaveResponse{}
|
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "ConfigService.Save", req), rsp, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rsp, nil
|
|
}
|
|
|
|
type configServiceServer struct {
|
|
ConfigServiceServer
|
|
}
|
|
|
|
func (h *configServiceServer) Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error {
|
|
return h.ConfigServiceServer.Load(ctx, req, rsp)
|
|
}
|
|
|
|
func (h *configServiceServer) Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error {
|
|
return h.ConfigServiceServer.Save(ctx, req, rsp)
|
|
}
|
|
|
|
func RegisterConfigServiceServer(s server.Server, sh ConfigServiceServer, opts ...server.HandlerOption) error {
|
|
type configService interface {
|
|
Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error
|
|
Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error
|
|
}
|
|
type ConfigService struct {
|
|
configService
|
|
}
|
|
h := &configServiceServer{sh}
|
|
var nopts []server.HandlerOption
|
|
return s.Handle(s.NewHandler(&ConfigService{h}, append(nopts, opts...)...))
|
|
}
|