micro/server/proto/server.pb.micro.go

111 lines
3.1 KiB
Go
Raw Normal View History

2019-09-22 17:31:07 +03:00
// Code generated by protoc-gen-micro. DO NOT EDIT.
2020-05-24 20:45:57 +03:00
// source: server/proto/server.proto
2019-09-22 17:31:07 +03:00
package go_micro_server
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/unistack-org/micro/v3/api"
client "github.com/unistack-org/micro/v3/client"
server "github.com/unistack-org/micro/v3/server"
2019-09-22 17:31:07 +03:00
)
// 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
2019-09-22 17:31:07 +03:00
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Server service
func NewServerEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
2019-09-22 17:31:07 +03:00
// Client API for Server service
type ServerService interface {
Handle(ctx context.Context, in *HandleRequest, opts ...client.CallOption) (*HandleResponse, error)
Subscribe(ctx context.Context, in *SubscribeRequest, opts ...client.CallOption) (*SubscribeResponse, error)
}
type serverService struct {
c client.Client
name string
}
func NewServerService(name string, c client.Client) ServerService {
return &serverService{
c: c,
name: name,
}
}
func (c *serverService) Handle(ctx context.Context, in *HandleRequest, opts ...client.CallOption) (*HandleResponse, error) {
req := c.c.NewRequest(c.name, "Server.Handle", in)
out := new(HandleResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serverService) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...client.CallOption) (*SubscribeResponse, error) {
req := c.c.NewRequest(c.name, "Server.Subscribe", in)
out := new(SubscribeResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Server service
type ServerHandler interface {
Handle(context.Context, *HandleRequest, *HandleResponse) error
Subscribe(context.Context, *SubscribeRequest, *SubscribeResponse) error
}
func RegisterServerHandler(s server.Server, hdlr ServerHandler, opts ...server.HandlerOption) error {
type server interface {
Handle(ctx context.Context, in *HandleRequest, out *HandleResponse) error
Subscribe(ctx context.Context, in *SubscribeRequest, out *SubscribeResponse) error
}
type Server struct {
server
}
h := &serverHandler{hdlr}
return s.Handle(s.NewHandler(&Server{h}, opts...))
}
type serverHandler struct {
ServerHandler
}
func (h *serverHandler) Handle(ctx context.Context, in *HandleRequest, out *HandleResponse) error {
return h.ServerHandler.Handle(ctx, in, out)
}
func (h *serverHandler) Subscribe(ctx context.Context, in *SubscribeRequest, out *SubscribeResponse) error {
return h.ServerHandler.Subscribe(ctx, in, out)
}