micro-logger-service/proto/service_micro.pb.go
Vasiliy Tolstov 6032dfbadc initial import
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-13 08:11:44 +03:00

45 lines
1.1 KiB
Go

// Code generated by protoc-gen-micro
// source: service.proto
package service
import (
"context"
micro_api "github.com/unistack-org/micro/v3/api"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
// NewLoggerEndpoints provides api endpoints metdata for Logger service
func NewLoggerEndpoints() []*micro_api.Endpoint {
var endpoints []*micro_api.Endpoint
return endpoints
}
// LoggerService interface
type LoggerService interface {
Log(context.Context, *Message, ...micro_client.CallOption) (*Empty, error)
}
// Micro server stuff
// LoggerHandler server handler
type LoggerHandler interface {
Log(context.Context, *Message, *Empty) error
}
// RegisterLoggerHandler registers server handler
func RegisterLoggerHandler(s micro_server.Server, sh LoggerHandler, opts ...micro_server.HandlerOption) error {
type logger interface {
Log(context.Context, *Message, *Empty) error
}
type Logger struct {
logger
}
h := &loggerHandler{sh}
for _, endpoint := range NewLoggerEndpoints() {
opts = append(opts, micro_api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&Logger{h}, opts...))
}