micro/server/proto/server.pb.micro.go
2019-11-26 13:53:33 +00:00

109 lines
3.0 KiB
Go

// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: github.com/micro/go-micro/server/proto/server.proto
package go_micro_server
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/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 _ context.Context
var _ client.Option
var _ server.Option
// 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 {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "go.micro.server"
}
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)
}