Files
services/time/proto/time.pb.micro.go
2021-06-21 19:42:12 +01:00

111 lines
2.9 KiB
Go

// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/time.proto
package time
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Time service
func NewTimeEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Time service
type TimeService interface {
Now(ctx context.Context, in *NowRequest, opts ...client.CallOption) (*NowResponse, error)
Zone(ctx context.Context, in *ZoneRequest, opts ...client.CallOption) (*ZoneResponse, error)
}
type timeService struct {
c client.Client
name string
}
func NewTimeService(name string, c client.Client) TimeService {
return &timeService{
c: c,
name: name,
}
}
func (c *timeService) Now(ctx context.Context, in *NowRequest, opts ...client.CallOption) (*NowResponse, error) {
req := c.c.NewRequest(c.name, "Time.Now", in)
out := new(NowResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *timeService) Zone(ctx context.Context, in *ZoneRequest, opts ...client.CallOption) (*ZoneResponse, error) {
req := c.c.NewRequest(c.name, "Time.Zone", in)
out := new(ZoneResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Time service
type TimeHandler interface {
Now(context.Context, *NowRequest, *NowResponse) error
Zone(context.Context, *ZoneRequest, *ZoneResponse) error
}
func RegisterTimeHandler(s server.Server, hdlr TimeHandler, opts ...server.HandlerOption) error {
type time interface {
Now(ctx context.Context, in *NowRequest, out *NowResponse) error
Zone(ctx context.Context, in *ZoneRequest, out *ZoneResponse) error
}
type Time struct {
time
}
h := &timeHandler{hdlr}
return s.Handle(s.NewHandler(&Time{h}, opts...))
}
type timeHandler struct {
TimeHandler
}
func (h *timeHandler) Now(ctx context.Context, in *NowRequest, out *NowResponse) error {
return h.TimeHandler.Now(ctx, in, out)
}
func (h *timeHandler) Zone(ctx context.Context, in *ZoneRequest, out *ZoneResponse) error {
return h.TimeHandler.Zone(ctx, in, out)
}