release: v2

This commit is contained in:
2024-03-19 01:03:14 +08:00
parent 06ed1f232d
commit 13fd643c7a
24 changed files with 2285 additions and 527 deletions

View File

@@ -0,0 +1,55 @@
// Code generated by protoc-gen-coco. DO NOT EDIT.
// source: v1/pastebin_model.proto
// generate at: 2024-03-19 01:01:42
package genv1
const TableNameModelPastebin = "pastebin"
func (t *ModelPastebin) TableName() string {
return "pastebin"
}
func (m *ModelPastebin) GetIdField() string {
return "_id"
}
func (m *ModelPastebin) GetCreatedAtField() string {
return "created_at"
}
func (m *ModelPastebin) GetExpiredAtField() string {
return "expired_at"
}
func (m *ModelPastebin) GetShortIdField() string {
return "short_id"
}
func (m *ModelPastebin) GetTitleField() string {
return "title"
}
func (m *ModelPastebin) GetAuthorField() string {
return "author"
}
func (m *ModelPastebin) GetContentField() string {
return "content"
}
func (m *ModelPastebin) GetLangField() string {
return "lang"
}
func (m *ModelPastebin) GetPasswordField() string {
return "password"
}
func (m *ModelPastebin) GetNeedPasswordField() string {
return "need_password"
}
func (m *ModelPastebin) GetEditableField() string {
return "editable"
}

View File

@@ -0,0 +1,57 @@
// Code generated by protoc-gen-coco. DO NOT EDIT.
// source: v1/pastebin_module.proto
// generate at: 2024-03-19 01:01:42
package genv1
import (
"gitter.top/coco/coco"
)
type AutoGenPastebinServiceImpl interface {
List(ctx *coco.Context, req *PastebinServiceListReq) (resp *PastebinServiceListResp, err error)
Add(ctx *coco.Context, req *PastebinServiceAddReq) (resp *PastebinServiceAddResp, err error)
Update(ctx *coco.Context, req *PastebinServiceUpdateReq) (resp *PastebinServiceUpdateResp, err error)
Get(ctx *coco.Context, req *PastebinServiceGetReq) (resp *PastebinServiceGetResp, err error)
Raw(ctx *coco.Context, req *PastebinServiceRawReq) (resp *PastebinServiceRawResp, err error)
}
type PastebinService_RouterMap struct{}
func (receiver *PastebinService_RouterMap) GetRouterMap() *coco.Routers {
return &coco.Routers{
BaseURL: "/v1/pastebin",
Apis: coco.RouterMap{
"List": {
API: "/list",
Method: "GET",
Author: "Young Xu",
Describe: "列表",
},
"Add": {
API: "/add",
Method: "PUT",
Author: "Young Xu",
Describe: "新建",
},
"Update": {
API: "/update",
Method: "POST",
Author: "Young Xu",
Describe: "更新",
},
"Get": {
API: "/get",
Method: "GET",
Author: "Young Xu",
Describe: "获取一条记录",
},
"Raw": {
API: "/raw",
Method: "GET",
Author: "Young Xu",
Describe: "获取原文内容",
},
},
}
}

241
gen/v1/pastebin_model.pb.go Normal file
View File

@@ -0,0 +1,241 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc (unknown)
// source: v1/pastebin_model.proto
package genv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// @table_name: pastebin
type ModelPastebin struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // ID
CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间
ExpiredAt int64 `protobuf:"varint,3,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"` // 过期时间
ShortId string `protobuf:"bytes,4,opt,name=short_id,json=shortId,proto3" json:"short_id,omitempty"` // ID别名
Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` // 标题
Author string `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"` // 作者
Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content,omitempty"` // 内容
Lang string `protobuf:"bytes,8,opt,name=lang,proto3" json:"lang,omitempty"` // 语言
Password string `protobuf:"bytes,9,opt,name=password,proto3" json:"password,omitempty"` // 是否需要密码
NeedPassword bool `protobuf:"varint,10,opt,name=need_password,json=needPassword,proto3" json:"need_password,omitempty"` // 是否需要密码
Editable bool `protobuf:"varint,11,opt,name=editable,proto3" json:"editable,omitempty"` // 是否可以修改
}
func (x *ModelPastebin) Reset() {
*x = ModelPastebin{}
if protoimpl.UnsafeEnabled {
mi := &file_v1_pastebin_model_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ModelPastebin) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ModelPastebin) ProtoMessage() {}
func (x *ModelPastebin) ProtoReflect() protoreflect.Message {
mi := &file_v1_pastebin_model_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ModelPastebin.ProtoReflect.Descriptor instead.
func (*ModelPastebin) Descriptor() ([]byte, []int) {
return file_v1_pastebin_model_proto_rawDescGZIP(), []int{0}
}
func (x *ModelPastebin) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *ModelPastebin) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *ModelPastebin) GetExpiredAt() int64 {
if x != nil {
return x.ExpiredAt
}
return 0
}
func (x *ModelPastebin) GetShortId() string {
if x != nil {
return x.ShortId
}
return ""
}
func (x *ModelPastebin) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *ModelPastebin) GetAuthor() string {
if x != nil {
return x.Author
}
return ""
}
func (x *ModelPastebin) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *ModelPastebin) GetLang() string {
if x != nil {
return x.Lang
}
return ""
}
func (x *ModelPastebin) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *ModelPastebin) GetNeedPassword() bool {
if x != nil {
return x.NeedPassword
}
return false
}
func (x *ModelPastebin) GetEditable() bool {
if x != nil {
return x.Editable
}
return false
}
var File_v1_pastebin_model_proto protoreflect.FileDescriptor
var file_v1_pastebin_model_proto_rawDesc = []byte{
0x0a, 0x17, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x73, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x5f, 0x6d, 0x6f,
0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
0x2e, 0x76, 0x31, 0x22, 0xb1, 0x02, 0x0a, 0x0d, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x50, 0x61, 0x73,
0x74, 0x65, 0x62, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64,
0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x5f,
0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65,
0x64, 0x41, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x14,
0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74,
0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07,
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x08,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61,
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61,
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x6e, 0x65, 0x65, 0x64, 0x5f, 0x70,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6e,
0x65, 0x65, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x65,
0x64, 0x69, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x65,
0x64, 0x69, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x14, 0x5a, 0x12, 0x70, 0x61, 0x73, 0x74, 0x65,
0x62, 0x69, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x3b, 0x67, 0x65, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_v1_pastebin_model_proto_rawDescOnce sync.Once
file_v1_pastebin_model_proto_rawDescData = file_v1_pastebin_model_proto_rawDesc
)
func file_v1_pastebin_model_proto_rawDescGZIP() []byte {
file_v1_pastebin_model_proto_rawDescOnce.Do(func() {
file_v1_pastebin_model_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_pastebin_model_proto_rawDescData)
})
return file_v1_pastebin_model_proto_rawDescData
}
var file_v1_pastebin_model_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_v1_pastebin_model_proto_goTypes = []interface{}{
(*ModelPastebin)(nil), // 0: model.v1.ModelPastebin
}
var file_v1_pastebin_model_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_v1_pastebin_model_proto_init() }
func file_v1_pastebin_model_proto_init() {
if File_v1_pastebin_model_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_v1_pastebin_model_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ModelPastebin); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v1_pastebin_model_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_v1_pastebin_model_proto_goTypes,
DependencyIndexes: file_v1_pastebin_model_proto_depIdxs,
MessageInfos: file_v1_pastebin_model_proto_msgTypes,
}.Build()
File_v1_pastebin_model_proto = out.File
file_v1_pastebin_model_proto_rawDesc = nil
file_v1_pastebin_model_proto_goTypes = nil
file_v1_pastebin_model_proto_depIdxs = nil
}

1008
gen/v1/pastebin_module.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,295 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: v1/pastebin_module.proto
package genv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
PastebinService_List_FullMethodName = "/api_services.v1.PastebinService/List"
PastebinService_Add_FullMethodName = "/api_services.v1.PastebinService/Add"
PastebinService_Update_FullMethodName = "/api_services.v1.PastebinService/Update"
PastebinService_Get_FullMethodName = "/api_services.v1.PastebinService/Get"
PastebinService_Raw_FullMethodName = "/api_services.v1.PastebinService/Raw"
)
// PastebinServiceClient is the client API for PastebinService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PastebinServiceClient interface {
// @desc: 列表
// @author: Young Xu
// @method: GET
// @api: /list
List(ctx context.Context, in *PastebinServiceListReq, opts ...grpc.CallOption) (*PastebinServiceListResp, error)
// @desc: 新建
// @author: Young Xu
// @method: PUT
// @api: /add
Add(ctx context.Context, in *PastebinServiceAddReq, opts ...grpc.CallOption) (*PastebinServiceAddResp, error)
// @desc: 更新
// @author: Young Xu
// @method: POST
// @api: /update
Update(ctx context.Context, in *PastebinServiceUpdateReq, opts ...grpc.CallOption) (*PastebinServiceUpdateResp, error)
// @desc: 获取一条记录
// @author: Young Xu
// @method: GET
// @api: /get
Get(ctx context.Context, in *PastebinServiceGetReq, opts ...grpc.CallOption) (*PastebinServiceGetResp, error)
// @desc: 获取原文内容
// @author: Young Xu
// @method: GET
// @api: /raw
Raw(ctx context.Context, in *PastebinServiceRawReq, opts ...grpc.CallOption) (*PastebinServiceRawResp, error)
}
type pastebinServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPastebinServiceClient(cc grpc.ClientConnInterface) PastebinServiceClient {
return &pastebinServiceClient{cc}
}
func (c *pastebinServiceClient) List(ctx context.Context, in *PastebinServiceListReq, opts ...grpc.CallOption) (*PastebinServiceListResp, error) {
out := new(PastebinServiceListResp)
err := c.cc.Invoke(ctx, PastebinService_List_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pastebinServiceClient) Add(ctx context.Context, in *PastebinServiceAddReq, opts ...grpc.CallOption) (*PastebinServiceAddResp, error) {
out := new(PastebinServiceAddResp)
err := c.cc.Invoke(ctx, PastebinService_Add_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pastebinServiceClient) Update(ctx context.Context, in *PastebinServiceUpdateReq, opts ...grpc.CallOption) (*PastebinServiceUpdateResp, error) {
out := new(PastebinServiceUpdateResp)
err := c.cc.Invoke(ctx, PastebinService_Update_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pastebinServiceClient) Get(ctx context.Context, in *PastebinServiceGetReq, opts ...grpc.CallOption) (*PastebinServiceGetResp, error) {
out := new(PastebinServiceGetResp)
err := c.cc.Invoke(ctx, PastebinService_Get_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pastebinServiceClient) Raw(ctx context.Context, in *PastebinServiceRawReq, opts ...grpc.CallOption) (*PastebinServiceRawResp, error) {
out := new(PastebinServiceRawResp)
err := c.cc.Invoke(ctx, PastebinService_Raw_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PastebinServiceServer is the server API for PastebinService service.
// All implementations should embed UnimplementedPastebinServiceServer
// for forward compatibility
type PastebinServiceServer interface {
// @desc: 列表
// @author: Young Xu
// @method: GET
// @api: /list
List(context.Context, *PastebinServiceListReq) (*PastebinServiceListResp, error)
// @desc: 新建
// @author: Young Xu
// @method: PUT
// @api: /add
Add(context.Context, *PastebinServiceAddReq) (*PastebinServiceAddResp, error)
// @desc: 更新
// @author: Young Xu
// @method: POST
// @api: /update
Update(context.Context, *PastebinServiceUpdateReq) (*PastebinServiceUpdateResp, error)
// @desc: 获取一条记录
// @author: Young Xu
// @method: GET
// @api: /get
Get(context.Context, *PastebinServiceGetReq) (*PastebinServiceGetResp, error)
// @desc: 获取原文内容
// @author: Young Xu
// @method: GET
// @api: /raw
Raw(context.Context, *PastebinServiceRawReq) (*PastebinServiceRawResp, error)
}
// UnimplementedPastebinServiceServer should be embedded to have forward compatible implementations.
type UnimplementedPastebinServiceServer struct {
}
func (UnimplementedPastebinServiceServer) List(context.Context, *PastebinServiceListReq) (*PastebinServiceListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedPastebinServiceServer) Add(context.Context, *PastebinServiceAddReq) (*PastebinServiceAddResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Add not implemented")
}
func (UnimplementedPastebinServiceServer) Update(context.Context, *PastebinServiceUpdateReq) (*PastebinServiceUpdateResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (UnimplementedPastebinServiceServer) Get(context.Context, *PastebinServiceGetReq) (*PastebinServiceGetResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedPastebinServiceServer) Raw(context.Context, *PastebinServiceRawReq) (*PastebinServiceRawResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Raw not implemented")
}
// UnsafePastebinServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PastebinServiceServer will
// result in compilation errors.
type UnsafePastebinServiceServer interface {
mustEmbedUnimplementedPastebinServiceServer()
}
func RegisterPastebinServiceServer(s grpc.ServiceRegistrar, srv PastebinServiceServer) {
s.RegisterService(&PastebinService_ServiceDesc, srv)
}
func _PastebinService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PastebinServiceListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PastebinServiceServer).List(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PastebinService_List_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PastebinServiceServer).List(ctx, req.(*PastebinServiceListReq))
}
return interceptor(ctx, in, info, handler)
}
func _PastebinService_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PastebinServiceAddReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PastebinServiceServer).Add(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PastebinService_Add_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PastebinServiceServer).Add(ctx, req.(*PastebinServiceAddReq))
}
return interceptor(ctx, in, info, handler)
}
func _PastebinService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PastebinServiceUpdateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PastebinServiceServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PastebinService_Update_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PastebinServiceServer).Update(ctx, req.(*PastebinServiceUpdateReq))
}
return interceptor(ctx, in, info, handler)
}
func _PastebinService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PastebinServiceGetReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PastebinServiceServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PastebinService_Get_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PastebinServiceServer).Get(ctx, req.(*PastebinServiceGetReq))
}
return interceptor(ctx, in, info, handler)
}
func _PastebinService_Raw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PastebinServiceRawReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PastebinServiceServer).Raw(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PastebinService_Raw_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PastebinServiceServer).Raw(ctx, req.(*PastebinServiceRawReq))
}
return interceptor(ctx, in, info, handler)
}
// PastebinService_ServiceDesc is the grpc.ServiceDesc for PastebinService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PastebinService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "api_services.v1.PastebinService",
HandlerType: (*PastebinServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "List",
Handler: _PastebinService_List_Handler,
},
{
MethodName: "Add",
Handler: _PastebinService_Add_Handler,
},
{
MethodName: "Update",
Handler: _PastebinService_Update_Handler,
},
{
MethodName: "Get",
Handler: _PastebinService_Get_Handler,
},
{
MethodName: "Raw",
Handler: _PastebinService_Raw_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "v1/pastebin_module.proto",
}

25
gen/wire/wire.go Normal file
View File

@@ -0,0 +1,25 @@
//go:build wireinject
// +build wireinject
package wire
import (
"github.com/google/wire"
"pastebin/gen/v1"
"pastebin/services/controller/v1"
)
type PastebinService struct {
*controllerv1.PastebinService
*genv1.PastebinService_RouterMap
}
func NewPastebinService(c *controllerv1.PastebinService, r *genv1.PastebinService_RouterMap) *PastebinService {
return &PastebinService{c, r}
}
func InitPastebinService() *PastebinService {
wire.Build(wire.Struct(new(controllerv1.PastebinService)), wire.Struct(new(genv1.PastebinService_RouterMap)), NewPastebinService)
return &PastebinService{}
}

32
gen/wire/wire_gen.go Normal file
View File

@@ -0,0 +1,32 @@
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package wire
import (
"pastebin/gen/v1"
"pastebin/services/controller/v1"
)
// Injectors from wire.go:
func InitPastebinService() *PastebinService {
pastebinService := &controllerv1.PastebinService{}
pastebinService_RouterMap := &genv1.PastebinService_RouterMap{}
wirePastebinService := NewPastebinService(pastebinService, pastebinService_RouterMap)
return wirePastebinService
}
// wire.go:
type PastebinService struct {
*controllerv1.PastebinService
*genv1.PastebinService_RouterMap
}
func NewPastebinService(c *controllerv1.PastebinService, r *genv1.PastebinService_RouterMap) *PastebinService {
return &PastebinService{c, r}
}