regen with never protoc-gen-go

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-03-22 09:48:12 +03:00
parent 6625c96cc8
commit a5b049abf9
11 changed files with 106 additions and 613 deletions

22
micro/service_micro.pb.go Normal file
View File

@@ -0,0 +1,22 @@
// Code generated by protoc-gen-micro
// source: service.proto
package service
import (
context "context"
proto "github.com/unistack-org/micro-logger-service/v3/proto"
api "github.com/unistack-org/micro/v3/api"
client "github.com/unistack-org/micro/v3/client"
)
func NewLoggerEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
type LoggerClient interface {
Log(ctx context.Context, req *proto.Message, opts ...client.CallOption) (*proto.Empty, error)
}
type LoggerServer interface {
Log(ctx context.Context, req *proto.Message, rsp *proto.Empty) error
}

View File

@@ -0,0 +1,51 @@
// Code generated by protoc-gen-micro
// source: service.proto
package service
import (
context "context"
proto "github.com/unistack-org/micro-logger-service/v3/proto"
api "github.com/unistack-org/micro/v3/api"
client "github.com/unistack-org/micro/v3/client"
server "github.com/unistack-org/micro/v3/server"
)
type loggerClient struct {
c client.Client
name string
}
func NewLoggerClient(name string, c client.Client) LoggerClient {
return &loggerClient{c: c, name: name}
}
func (c *loggerClient) Log(ctx context.Context, req *proto.Message, opts ...client.CallOption) (*proto.Empty, error) {
rsp := &proto.Empty{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Logger.Log", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
type loggerServer struct {
LoggerServer
}
func (h *loggerServer) Log(ctx context.Context, req *proto.Message, rsp *proto.Empty) error {
return h.LoggerServer.Log(ctx, req, rsp)
}
func RegisterLoggerServer(s server.Server, sh LoggerServer, opts ...server.HandlerOption) error {
type logger interface {
Log(ctx context.Context, req *proto.Message, rsp *proto.Empty) error
}
type Logger struct {
logger
}
h := &loggerServer{sh}
for _, endpoint := range NewLoggerEndpoints() {
opts = append(opts, api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&Logger{h}, opts...))
}