-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest_service.go
38 lines (30 loc) · 1.01 KB
/
rest_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package service
import (
"google.golang.org/grpc"
)
// KitTemplateRESTService Wrapper on top of the GRPC server to be able to use the interceptor for
// REST request as it is used for grpc request.
type KitTemplateRESTService struct {
*KitTemplateService
unaryInt grpc.UnaryServerInterceptor
}
// NewKitTemplateRESTService creates an instance of QontoService.
func NewKitTemplateRESTService(service *KitTemplateService) *KitTemplateRESTService {
return &KitTemplateRESTService{
KitTemplateService: service,
}
}
/*
// PostFuncName is wrapper on the unary RPC to ... for REST calls.
func (s *KitTemplateRESTService) PostFuncName(ctx context.Context, req interface{}) (interface{}, error) {
info := &grpc.UnaryServerInfo{
Server: s.KitTemplateService,
FullMethod: "/kit.template.Service/PostFuncName",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return s.KitTemplateService.PostFuncName(ctx, req)
}
resp, err := s.unaryInt(ctx, req, info, handler)
return resp, err
}
*/