47 lines
984 B
Go
47 lines
984 B
Go
|
// Code generated by protoc-gen-micro
|
||
|
// source: test.proto
|
||
|
package helloworld
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
micro_client "github.com/unistack-org/micro/v3/client"
|
||
|
micro_server "github.com/unistack-org/micro/v3/server"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
_ micro_server.Option
|
||
|
_ micro_client.Option
|
||
|
)
|
||
|
|
||
|
type testService struct {
|
||
|
c micro_client.Client
|
||
|
name string
|
||
|
}
|
||
|
|
||
|
// Micro client stuff
|
||
|
|
||
|
// NewTestService create new service client
|
||
|
func NewTestService(name string, c micro_client.Client) TestService {
|
||
|
return &testService{c: c, name: name}
|
||
|
}
|
||
|
|
||
|
func (c *testService) Call(ctx context.Context, req *Request, opts ...micro_client.CallOption) (*Response, error) {
|
||
|
rsp := &Response{}
|
||
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.Call", req), rsp, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return rsp, nil
|
||
|
}
|
||
|
|
||
|
// Micro server stuff
|
||
|
|
||
|
type testHandler struct {
|
||
|
TestHandler
|
||
|
}
|
||
|
|
||
|
func (h *testHandler) Call(ctx context.Context, req *Request, rsp *Response) error {
|
||
|
return h.TestHandler.Call(ctx, req, rsp)
|
||
|
}
|