// Code generated by protoc-gen-micro. DO NOT EDIT. // source: test.proto package helloworld 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" ) // 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 Test service func NewTestEndpoints() []*api.Endpoint { return []*api.Endpoint{} } // Client API for Test service type TestService interface { CallNative(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error) CallMicro(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error) Stream(ctx context.Context, opts ...client.CallOption) (Test_StreamService, error) } type testService struct { c client.Client name string } func NewTestService(name string, c client.Client) TestService { return &testService{ c: c, name: name, } } func (c *testService) CallNative(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error) { rsp := &Response{} err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.CallNative", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } func (c *testService) CallMicro(ctx context.Context, req *Request, opts ...client.CallOption) (*Response, error) { rsp := &Response{} err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.CallMicro", req), rsp, opts...) if err != nil { return nil, err } return rsp, nil } func (c *testService) Stream(ctx context.Context, opts ...client.CallOption) (Test_StreamService, error) { stream, err := c.c.Stream(ctx, c.c.NewRequest(c.name, "Test.Stream", &Request{}), opts...) if err != nil { return nil, err } return &testServiceStream{stream}, nil } type Test_StreamService interface { Context() context.Context SendMsg(interface{}) error RecvMsg(interface{}) error Close() error Send(*Request) error Recv() (*Response, error) } type testServiceStream struct { stream client.Stream } func (x *testServiceStream) Close() error { return x.stream.Close() } func (x *testServiceStream) Context() context.Context { return x.stream.Context() } func (x *testServiceStream) SendMsg(m interface{}) error { return x.stream.Send(m) } func (x *testServiceStream) RecvMsg(m interface{}) error { return x.stream.Recv(m) } func (x *testServiceStream) Send(m *Request) error { return x.stream.Send(m) } func (x *testServiceStream) Recv() (*Response, error) { m := &Response{} err := x.stream.Recv(m) if err != nil { return nil, err } return m, nil } // Server API for Test service type TestHandler interface { CallNative(context.Context, *Request, *Response) error CallMicro(context.Context, *Request, *Response) error Stream(context.Context, Test_StreamStream) error } func RegisterTestHandler(s server.Server, hdlr TestHandler, opts ...server.HandlerOption) error { type test interface { CallNative(ctx context.Context, req *Request, rsp *Response) error CallMicro(ctx context.Context, req *Request, rsp *Response) error Stream(ctx context.Context, stream server.Stream) error } type Test struct { test } h := &testHandler{hdlr} return s.Handle(s.NewHandler(&Test{h}, opts...)) } type testHandler struct { TestHandler } func (h *testHandler) CallNative(ctx context.Context, req *Request, rsp *Response) error { return h.TestHandler.CallNative(ctx, req, rsp) } func (h *testHandler) CallMicro(ctx context.Context, req *Request, rsp *Response) error { return h.TestHandler.CallMicro(ctx, req, rsp) } func (h *testHandler) Stream(ctx context.Context, stream server.Stream) error { return h.TestHandler.Stream(ctx, &testStreamStream{stream}) } type Test_StreamStream interface { Context() context.Context SendMsg(interface{}) error RecvMsg(interface{}) error Close() error Send(*Response) error Recv() (*Request, error) } type testStreamStream struct { stream server.Stream } func (x *testStreamStream) Close() error { return x.stream.Close() } func (x *testStreamStream) Context() context.Context { return x.stream.Context() } func (x *testStreamStream) SendMsg(m interface{}) error { return x.stream.Send(m) } func (x *testStreamStream) RecvMsg(m interface{}) error { return x.stream.Recv(m) } func (x *testStreamStream) Send(m *Response) error { return x.stream.Send(m) } func (x *testStreamStream) Recv() (*Request, error) { m := &Request{} if err := x.stream.Recv(m); err != nil { return nil, err } return m, nil }