micro-tests/server/grpc/proto/test_micro.pb.go
Vasiliy Tolstov ac192b7ef5 update all deps to latest versions
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-29 16:47:26 +03:00

53 lines
1.3 KiB
Go

// Code generated by protoc-gen-micro
// source: test.proto
package helloworld
import (
"context"
micro_api "github.com/unistack-org/micro/v3/api"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
// NewTestEndpoints provides api endpoints metdata for Test service
func NewTestEndpoints() []*micro_api.Endpoint {
var endpoints []*micro_api.Endpoint
endpoint := &micro_api.Endpoint{
Name: "Test.Call",
Path: []string{"/api/v0/test/call/TEST"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
}
endpoints = append(endpoints, endpoint)
return endpoints
}
// TestService interface
type TestService interface {
Call(context.Context, *Request, ...micro_client.CallOption) (*Response, error)
}
// Micro server stuff
// TestHandler server handler
type TestHandler interface {
Call(context.Context, *Request, *Response) error
}
// RegisterTestHandler registers server handler
func RegisterTestHandler(s micro_server.Server, sh TestHandler, opts ...micro_server.HandlerOption) error {
type test interface {
Call(context.Context, *Request, *Response) error
}
type Test struct {
test
}
h := &testHandler{sh}
for _, endpoint := range NewTestEndpoints() {
opts = append(opts, micro_api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&Test{h}, opts...))
}