-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_gors.pb.go
94 lines (84 loc) · 3.13 KB
/
message_gors.pb.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2021 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by protoc-gen-gors. DO NOT EDIT.
// versions:
// - protoc-gen-gors v1.3.0
// - protoc v4.24.3
// source: example/api/tests/mapfields/message.proto
package mapfields
import (
context "context"
gin "github.com/gin-gonic/gin"
gors "github.com/go-leo/gors"
binding "github.com/go-leo/gors/pkg/binding"
)
func MessagingServiceRoutes(svc MessagingService, opts ...gors.Option) []gors.Route {
options := gors.NewOptions(opts...)
wrapper := &_MessagingServiceWrapper{svc: svc, options: options}
_ = wrapper
return []gors.Route{
gors.NewRoute("PATCH", "/v1/messages/:message_id", _Messaging_UpdateMessage_GORS_Handler(wrapper, options, _Messaging_UpdateMessage_GORS_Handler_PATCH_71b8052a59ef2e1e6bb26f276891271b_Binding())),
}
}
// MessagingService is the service API for Messaging service.
type MessagingService interface {
UpdateMessage(context.Context, *Message) (*Message, error)
}
var _ MessagingService = (*_MessagingServiceWrapper)(nil)
type _MessagingServiceWrapper struct {
svc MessagingService
options *gors.Options
}
func (wrapper *_MessagingServiceWrapper) UpdateMessage(ctx context.Context, request *Message) (*Message, error) {
return wrapper.svc.UpdateMessage(ctx, request)
}
func _Messaging_UpdateMessage_GORS_Handler(svc MessagingService, options *gors.Options, binding *binding.HttpRuleBinding) func(c *gin.Context) {
return func(c *gin.Context) {
var rpcMethodName = "/tests.mapfields.message.v1.Messaging/UpdateMessage"
var ctx = gors.NewContext(c, rpcMethodName)
var req *Message
var resp *Message
var err error
req = new(Message)
if err = gors.RequestBind(
ctx, req, options.Tag,
gors.HttpRuleBinding(binding),
); err != nil {
gors.ErrorRender(ctx, err, options.ErrorHandler, options.ResponseWrapper)
return
}
if ctx, err = gors.NewGRPCContext(ctx, options.IncomingHeaderMatcher, options.MetadataAnnotators); err != nil {
gors.ErrorRender(ctx, err, options.ErrorHandler, options.ResponseWrapper)
return
}
resp, err = svc.UpdateMessage(ctx, req)
if err != nil {
gors.ErrorRender(ctx, err, options.ErrorHandler, options.ResponseWrapper)
return
}
gors.ResponseRender(ctx, gors.StatusCode(ctx), resp, "", gors.ProtoJSONRender(options.ProtoJSONMarshalOptions), options.ResponseWrapper)
}
}
func _Messaging_UpdateMessage_GORS_Handler_PATCH_71b8052a59ef2e1e6bb26f276891271b_Binding() *binding.HttpRuleBinding {
return &binding.HttpRuleBinding{
Path: []*binding.PathRule{
{Name: "message_id", Type: "string"},
},
Body: &binding.BodyRule{
Name: "*",
Type: "object",
},
}
}