regen with never protoc-gen-go
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
22
micro/service_micro.pb.go
Normal file
22
micro/service_micro.pb.go
Normal 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
|
||||
}
|
51
micro/service_micro_rpc.pb.go
Normal file
51
micro/service_micro_rpc.pb.go
Normal 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...))
|
||||
}
|
Reference in New Issue
Block a user