47 lines
993 B
Go
47 lines
993 B
Go
// Code generated by protoc-gen-micro
|
|
// source: service.proto
|
|
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
micro_client "github.com/unistack-org/micro/v3/client"
|
|
micro_server "github.com/unistack-org/micro/v3/server"
|
|
)
|
|
|
|
var (
|
|
_ micro_server.Option
|
|
_ micro_client.Option
|
|
)
|
|
|
|
type loggerService struct {
|
|
c micro_client.Client
|
|
name string
|
|
}
|
|
|
|
// Micro client stuff
|
|
|
|
// NewLoggerService create new service client
|
|
func NewLoggerService(name string, c micro_client.Client) LoggerService {
|
|
return &loggerService{c: c, name: name}
|
|
}
|
|
|
|
func (c *loggerService) Log(ctx context.Context, req *Message, opts ...micro_client.CallOption) (*Empty, error) {
|
|
rsp := &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
|
|
}
|
|
|
|
// Micro server stuff
|
|
|
|
type loggerHandler struct {
|
|
LoggerHandler
|
|
}
|
|
|
|
func (h *loggerHandler) Log(ctx context.Context, req *Message, rsp *Empty) error {
|
|
return h.LoggerHandler.Log(ctx, req, rsp)
|
|
}
|