-
Notifications
You must be signed in to change notification settings - Fork 330
/
backend.micro.go
197 lines (168 loc) · 6.62 KB
/
backend.micro.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: backend.proto
/*
Package backend is a generated protocol buffer package.
It is generated from these files:
backend.proto
It has these top-level messages:
CreateBackendRequest
CreateBackendResponse
GetBackendRequest
GetBackendResponse
ListBackendRequest
ListBackendResponse
UpdateBackendRequest
UpdateBackendResponse
DeleteBackendRequest
DeleteBackendResponse
BackendDetail
ListTypeRequest
ListTypeResponse
TypeDetail
*/
package backend
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "context"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/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.ProtoPackageIsVersion2 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for Backend service
type BackendService interface {
CreateBackend(ctx context.Context, in *CreateBackendRequest, opts ...client.CallOption) (*CreateBackendResponse, error)
GetBackend(ctx context.Context, in *GetBackendRequest, opts ...client.CallOption) (*GetBackendResponse, error)
ListBackend(ctx context.Context, in *ListBackendRequest, opts ...client.CallOption) (*ListBackendResponse, error)
UpdateBackend(ctx context.Context, in *UpdateBackendRequest, opts ...client.CallOption) (*UpdateBackendResponse, error)
DeleteBackend(ctx context.Context, in *DeleteBackendRequest, opts ...client.CallOption) (*DeleteBackendResponse, error)
ListType(ctx context.Context, in *ListTypeRequest, opts ...client.CallOption) (*ListTypeResponse, error)
}
type backendService struct {
c client.Client
name string
}
func NewBackendService(name string, c client.Client) BackendService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "backend"
}
return &backendService{
c: c,
name: name,
}
}
func (c *backendService) CreateBackend(ctx context.Context, in *CreateBackendRequest, opts ...client.CallOption) (*CreateBackendResponse, error) {
req := c.c.NewRequest(c.name, "Backend.CreateBackend", in)
out := new(CreateBackendResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *backendService) GetBackend(ctx context.Context, in *GetBackendRequest, opts ...client.CallOption) (*GetBackendResponse, error) {
req := c.c.NewRequest(c.name, "Backend.GetBackend", in)
out := new(GetBackendResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *backendService) ListBackend(ctx context.Context, in *ListBackendRequest, opts ...client.CallOption) (*ListBackendResponse, error) {
req := c.c.NewRequest(c.name, "Backend.ListBackend", in)
out := new(ListBackendResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *backendService) UpdateBackend(ctx context.Context, in *UpdateBackendRequest, opts ...client.CallOption) (*UpdateBackendResponse, error) {
req := c.c.NewRequest(c.name, "Backend.UpdateBackend", in)
out := new(UpdateBackendResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *backendService) DeleteBackend(ctx context.Context, in *DeleteBackendRequest, opts ...client.CallOption) (*DeleteBackendResponse, error) {
req := c.c.NewRequest(c.name, "Backend.DeleteBackend", in)
out := new(DeleteBackendResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *backendService) ListType(ctx context.Context, in *ListTypeRequest, opts ...client.CallOption) (*ListTypeResponse, error) {
req := c.c.NewRequest(c.name, "Backend.ListType", in)
out := new(ListTypeResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Backend service
type BackendHandler interface {
CreateBackend(context.Context, *CreateBackendRequest, *CreateBackendResponse) error
GetBackend(context.Context, *GetBackendRequest, *GetBackendResponse) error
ListBackend(context.Context, *ListBackendRequest, *ListBackendResponse) error
UpdateBackend(context.Context, *UpdateBackendRequest, *UpdateBackendResponse) error
DeleteBackend(context.Context, *DeleteBackendRequest, *DeleteBackendResponse) error
ListType(context.Context, *ListTypeRequest, *ListTypeResponse) error
}
func RegisterBackendHandler(s server.Server, hdlr BackendHandler, opts ...server.HandlerOption) error {
type backend interface {
CreateBackend(ctx context.Context, in *CreateBackendRequest, out *CreateBackendResponse) error
GetBackend(ctx context.Context, in *GetBackendRequest, out *GetBackendResponse) error
ListBackend(ctx context.Context, in *ListBackendRequest, out *ListBackendResponse) error
UpdateBackend(ctx context.Context, in *UpdateBackendRequest, out *UpdateBackendResponse) error
DeleteBackend(ctx context.Context, in *DeleteBackendRequest, out *DeleteBackendResponse) error
ListType(ctx context.Context, in *ListTypeRequest, out *ListTypeResponse) error
}
type Backend struct {
backend
}
h := &backendHandler{hdlr}
return s.Handle(s.NewHandler(&Backend{h}, opts...))
}
type backendHandler struct {
BackendHandler
}
func (h *backendHandler) CreateBackend(ctx context.Context, in *CreateBackendRequest, out *CreateBackendResponse) error {
return h.BackendHandler.CreateBackend(ctx, in, out)
}
func (h *backendHandler) GetBackend(ctx context.Context, in *GetBackendRequest, out *GetBackendResponse) error {
return h.BackendHandler.GetBackend(ctx, in, out)
}
func (h *backendHandler) ListBackend(ctx context.Context, in *ListBackendRequest, out *ListBackendResponse) error {
return h.BackendHandler.ListBackend(ctx, in, out)
}
func (h *backendHandler) UpdateBackend(ctx context.Context, in *UpdateBackendRequest, out *UpdateBackendResponse) error {
return h.BackendHandler.UpdateBackend(ctx, in, out)
}
func (h *backendHandler) DeleteBackend(ctx context.Context, in *DeleteBackendRequest, out *DeleteBackendResponse) error {
return h.BackendHandler.DeleteBackend(ctx, in, out)
}
func (h *backendHandler) ListType(ctx context.Context, in *ListTypeRequest, out *ListTypeResponse) error {
return h.BackendHandler.ListType(ctx, in, out)
}