mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 11:15:12 +00:00
145 lines
4.3 KiB
Go
145 lines
4.3 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: github.com/micro/services/test/kv/proto/example.proto
|
|
|
|
package srv_test_example
|
|
|
|
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 Example service
|
|
|
|
func NewExampleEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for Example service
|
|
|
|
type ExampleService interface {
|
|
TestExpiry(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
|
TestList(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
|
TestListLimit(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
|
TestListOffset(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
|
}
|
|
|
|
type exampleService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewExampleService(name string, c client.Client) ExampleService {
|
|
return &exampleService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *exampleService) TestExpiry(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
|
req := c.c.NewRequest(c.name, "Example.TestExpiry", in)
|
|
out := new(Response)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *exampleService) TestList(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
|
req := c.c.NewRequest(c.name, "Example.TestList", in)
|
|
out := new(Response)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *exampleService) TestListLimit(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
|
req := c.c.NewRequest(c.name, "Example.TestListLimit", in)
|
|
out := new(Response)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *exampleService) TestListOffset(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
|
req := c.c.NewRequest(c.name, "Example.TestListOffset", in)
|
|
out := new(Response)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for Example service
|
|
|
|
type ExampleHandler interface {
|
|
TestExpiry(context.Context, *Request, *Response) error
|
|
TestList(context.Context, *Request, *Response) error
|
|
TestListLimit(context.Context, *Request, *Response) error
|
|
TestListOffset(context.Context, *Request, *Response) error
|
|
}
|
|
|
|
func RegisterExampleHandler(s server.Server, hdlr ExampleHandler, opts ...server.HandlerOption) error {
|
|
type example interface {
|
|
TestExpiry(ctx context.Context, in *Request, out *Response) error
|
|
TestList(ctx context.Context, in *Request, out *Response) error
|
|
TestListLimit(ctx context.Context, in *Request, out *Response) error
|
|
TestListOffset(ctx context.Context, in *Request, out *Response) error
|
|
}
|
|
type Example struct {
|
|
example
|
|
}
|
|
h := &exampleHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&Example{h}, opts...))
|
|
}
|
|
|
|
type exampleHandler struct {
|
|
ExampleHandler
|
|
}
|
|
|
|
func (h *exampleHandler) TestExpiry(ctx context.Context, in *Request, out *Response) error {
|
|
return h.ExampleHandler.TestExpiry(ctx, in, out)
|
|
}
|
|
|
|
func (h *exampleHandler) TestList(ctx context.Context, in *Request, out *Response) error {
|
|
return h.ExampleHandler.TestList(ctx, in, out)
|
|
}
|
|
|
|
func (h *exampleHandler) TestListLimit(ctx context.Context, in *Request, out *Response) error {
|
|
return h.ExampleHandler.TestListLimit(ctx, in, out)
|
|
}
|
|
|
|
func (h *exampleHandler) TestListOffset(ctx context.Context, in *Request, out *Response) error {
|
|
return h.ExampleHandler.TestListOffset(ctx, in, out)
|
|
}
|