mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
285 lines
6.9 KiB
Go
285 lines
6.9 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: proto/idiomatic.proto
|
|
|
|
package idiomatic
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
math "math"
|
|
)
|
|
|
|
import (
|
|
context "context"
|
|
api "github.com/micro/go-micro/v3/api"
|
|
client "github.com/micro/go-micro/v3/client"
|
|
server "github.com/micro/go-micro/v3/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 Idiomatic service
|
|
|
|
func NewIdiomaticEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for Idiomatic service
|
|
|
|
type IdiomaticService interface {
|
|
Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
|
Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Idiomatic_StreamService, error)
|
|
PingPong(ctx context.Context, opts ...client.CallOption) (Idiomatic_PingPongService, error)
|
|
}
|
|
|
|
type idiomaticService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewIdiomaticService(name string, c client.Client) IdiomaticService {
|
|
return &idiomaticService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *idiomaticService) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
|
req := c.c.NewRequest(c.name, "Idiomatic.Call", in)
|
|
out := new(Response)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *idiomaticService) Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Idiomatic_StreamService, error) {
|
|
req := c.c.NewRequest(c.name, "Idiomatic.Stream", &StreamingRequest{})
|
|
stream, err := c.c.Stream(ctx, req, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if err := stream.Send(in); err != nil {
|
|
return nil, err
|
|
}
|
|
return &idiomaticServiceStream{stream}, nil
|
|
}
|
|
|
|
type Idiomatic_StreamService interface {
|
|
Context() context.Context
|
|
SendMsg(interface{}) error
|
|
RecvMsg(interface{}) error
|
|
Close() error
|
|
Recv() (*StreamingResponse, error)
|
|
}
|
|
|
|
type idiomaticServiceStream struct {
|
|
stream client.Stream
|
|
}
|
|
|
|
func (x *idiomaticServiceStream) Close() error {
|
|
return x.stream.Close()
|
|
}
|
|
|
|
func (x *idiomaticServiceStream) Context() context.Context {
|
|
return x.stream.Context()
|
|
}
|
|
|
|
func (x *idiomaticServiceStream) SendMsg(m interface{}) error {
|
|
return x.stream.Send(m)
|
|
}
|
|
|
|
func (x *idiomaticServiceStream) RecvMsg(m interface{}) error {
|
|
return x.stream.Recv(m)
|
|
}
|
|
|
|
func (x *idiomaticServiceStream) Recv() (*StreamingResponse, error) {
|
|
m := new(StreamingResponse)
|
|
err := x.stream.Recv(m)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (c *idiomaticService) PingPong(ctx context.Context, opts ...client.CallOption) (Idiomatic_PingPongService, error) {
|
|
req := c.c.NewRequest(c.name, "Idiomatic.PingPong", &Ping{})
|
|
stream, err := c.c.Stream(ctx, req, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &idiomaticServicePingPong{stream}, nil
|
|
}
|
|
|
|
type Idiomatic_PingPongService interface {
|
|
Context() context.Context
|
|
SendMsg(interface{}) error
|
|
RecvMsg(interface{}) error
|
|
Close() error
|
|
Send(*Ping) error
|
|
Recv() (*Pong, error)
|
|
}
|
|
|
|
type idiomaticServicePingPong struct {
|
|
stream client.Stream
|
|
}
|
|
|
|
func (x *idiomaticServicePingPong) Close() error {
|
|
return x.stream.Close()
|
|
}
|
|
|
|
func (x *idiomaticServicePingPong) Context() context.Context {
|
|
return x.stream.Context()
|
|
}
|
|
|
|
func (x *idiomaticServicePingPong) SendMsg(m interface{}) error {
|
|
return x.stream.Send(m)
|
|
}
|
|
|
|
func (x *idiomaticServicePingPong) RecvMsg(m interface{}) error {
|
|
return x.stream.Recv(m)
|
|
}
|
|
|
|
func (x *idiomaticServicePingPong) Send(m *Ping) error {
|
|
return x.stream.Send(m)
|
|
}
|
|
|
|
func (x *idiomaticServicePingPong) Recv() (*Pong, error) {
|
|
m := new(Pong)
|
|
err := x.stream.Recv(m)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// Server API for Idiomatic service
|
|
|
|
type IdiomaticHandler interface {
|
|
Call(context.Context, *Request, *Response) error
|
|
Stream(context.Context, *StreamingRequest, Idiomatic_StreamStream) error
|
|
PingPong(context.Context, Idiomatic_PingPongStream) error
|
|
}
|
|
|
|
func RegisterIdiomaticHandler(s server.Server, hdlr IdiomaticHandler, opts ...server.HandlerOption) error {
|
|
type idiomatic interface {
|
|
Call(ctx context.Context, in *Request, out *Response) error
|
|
Stream(ctx context.Context, stream server.Stream) error
|
|
PingPong(ctx context.Context, stream server.Stream) error
|
|
}
|
|
type Idiomatic struct {
|
|
idiomatic
|
|
}
|
|
h := &idiomaticHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&Idiomatic{h}, opts...))
|
|
}
|
|
|
|
type idiomaticHandler struct {
|
|
IdiomaticHandler
|
|
}
|
|
|
|
func (h *idiomaticHandler) Call(ctx context.Context, in *Request, out *Response) error {
|
|
return h.IdiomaticHandler.Call(ctx, in, out)
|
|
}
|
|
|
|
func (h *idiomaticHandler) Stream(ctx context.Context, stream server.Stream) error {
|
|
m := new(StreamingRequest)
|
|
if err := stream.Recv(m); err != nil {
|
|
return err
|
|
}
|
|
return h.IdiomaticHandler.Stream(ctx, m, &idiomaticStreamStream{stream})
|
|
}
|
|
|
|
type Idiomatic_StreamStream interface {
|
|
Context() context.Context
|
|
SendMsg(interface{}) error
|
|
RecvMsg(interface{}) error
|
|
Close() error
|
|
Send(*StreamingResponse) error
|
|
}
|
|
|
|
type idiomaticStreamStream struct {
|
|
stream server.Stream
|
|
}
|
|
|
|
func (x *idiomaticStreamStream) Close() error {
|
|
return x.stream.Close()
|
|
}
|
|
|
|
func (x *idiomaticStreamStream) Context() context.Context {
|
|
return x.stream.Context()
|
|
}
|
|
|
|
func (x *idiomaticStreamStream) SendMsg(m interface{}) error {
|
|
return x.stream.Send(m)
|
|
}
|
|
|
|
func (x *idiomaticStreamStream) RecvMsg(m interface{}) error {
|
|
return x.stream.Recv(m)
|
|
}
|
|
|
|
func (x *idiomaticStreamStream) Send(m *StreamingResponse) error {
|
|
return x.stream.Send(m)
|
|
}
|
|
|
|
func (h *idiomaticHandler) PingPong(ctx context.Context, stream server.Stream) error {
|
|
return h.IdiomaticHandler.PingPong(ctx, &idiomaticPingPongStream{stream})
|
|
}
|
|
|
|
type Idiomatic_PingPongStream interface {
|
|
Context() context.Context
|
|
SendMsg(interface{}) error
|
|
RecvMsg(interface{}) error
|
|
Close() error
|
|
Send(*Pong) error
|
|
Recv() (*Ping, error)
|
|
}
|
|
|
|
type idiomaticPingPongStream struct {
|
|
stream server.Stream
|
|
}
|
|
|
|
func (x *idiomaticPingPongStream) Close() error {
|
|
return x.stream.Close()
|
|
}
|
|
|
|
func (x *idiomaticPingPongStream) Context() context.Context {
|
|
return x.stream.Context()
|
|
}
|
|
|
|
func (x *idiomaticPingPongStream) SendMsg(m interface{}) error {
|
|
return x.stream.Send(m)
|
|
}
|
|
|
|
func (x *idiomaticPingPongStream) RecvMsg(m interface{}) error {
|
|
return x.stream.Recv(m)
|
|
}
|
|
|
|
func (x *idiomaticPingPongStream) Send(m *Pong) error {
|
|
return x.stream.Send(m)
|
|
}
|
|
|
|
func (x *idiomaticPingPongStream) Recv() (*Ping, error) {
|
|
m := new(Ping)
|
|
if err := x.stream.Recv(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|