move to micro v4
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-micro v3.10.2
|
||||
// - protoc-gen-go-micro v4.0.0
|
||||
// - protoc v3.21.12
|
||||
// source: service.proto
|
||||
|
||||
@@ -8,24 +8,24 @@ package servicepb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
proto "go.unistack.org/micro-config-service/v3/proto"
|
||||
v3 "go.unistack.org/micro-server-http/v3"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
proto "go.unistack.org/micro-config-service/v4/proto"
|
||||
v4 "go.unistack.org/micro-server-http/v4"
|
||||
client "go.unistack.org/micro/v4/client"
|
||||
)
|
||||
|
||||
var (
|
||||
ConfigName = "Config"
|
||||
ConfigServiceName = "ConfigService"
|
||||
)
|
||||
var (
|
||||
ConfigServerEndpoints = []v3.EndpointMetadata{}
|
||||
ConfigServiceServerEndpoints = []v4.EndpointMetadata{}
|
||||
)
|
||||
|
||||
type ConfigClient interface {
|
||||
type ConfigServiceClient interface {
|
||||
Load(ctx context.Context, req *proto.LoadRequest, opts ...client.CallOption) (*proto.LoadResponse, error)
|
||||
Save(ctx context.Context, req *proto.SaveRequest, opts ...client.CallOption) (*proto.SaveResponse, error)
|
||||
}
|
||||
|
||||
type ConfigServer interface {
|
||||
type ConfigServiceServer interface {
|
||||
Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error
|
||||
Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error
|
||||
}
|
||||
|
@@ -1,64 +1,64 @@
|
||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||
// protoc-gen-go-micro version: v3.10.2
|
||||
// protoc-gen-go-micro version: v4.0.0
|
||||
// source: service.proto
|
||||
|
||||
package servicepb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
proto "go.unistack.org/micro-config-service/v3/proto"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
server "go.unistack.org/micro/v3/server"
|
||||
proto "go.unistack.org/micro-config-service/v4/proto"
|
||||
client "go.unistack.org/micro/v4/client"
|
||||
server "go.unistack.org/micro/v4/server"
|
||||
)
|
||||
|
||||
type configClient struct {
|
||||
type configServiceClient struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewConfigClient(name string, c client.Client) ConfigClient {
|
||||
return &configClient{c: c, name: name}
|
||||
func NewConfigServiceClient(name string, c client.Client) ConfigServiceClient {
|
||||
return &configServiceClient{c: c, name: name}
|
||||
}
|
||||
|
||||
func (c *configClient) Load(ctx context.Context, req *proto.LoadRequest, opts ...client.CallOption) (*proto.LoadResponse, error) {
|
||||
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, "Config.Load", req), rsp, opts...)
|
||||
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 *configClient) Save(ctx context.Context, req *proto.SaveRequest, opts ...client.CallOption) (*proto.SaveResponse, error) {
|
||||
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, "Config.Save", req), rsp, opts...)
|
||||
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 configServer struct {
|
||||
ConfigServer
|
||||
type configServiceServer struct {
|
||||
ConfigServiceServer
|
||||
}
|
||||
|
||||
func (h *configServer) Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error {
|
||||
return h.ConfigServer.Load(ctx, req, rsp)
|
||||
func (h *configServiceServer) Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error {
|
||||
return h.ConfigServiceServer.Load(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *configServer) Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error {
|
||||
return h.ConfigServer.Save(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 RegisterConfigServer(s server.Server, sh ConfigServer, opts ...server.HandlerOption) error {
|
||||
type config interface {
|
||||
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 Config struct {
|
||||
config
|
||||
type ConfigService struct {
|
||||
configService
|
||||
}
|
||||
h := &configServer{sh}
|
||||
h := &configServiceServer{sh}
|
||||
var nopts []server.HandlerOption
|
||||
return s.Handle(s.NewHandler(&Config{h}, append(nopts, opts...)...))
|
||||
return s.Handle(s.NewHandler(&ConfigService{h}, append(nopts, opts...)...))
|
||||
}
|
||||
|
Reference in New Issue
Block a user