diff --git a/api/errors/resource_error_reason.pb.go b/api/errors/resource_error_reason.pb.go deleted file mode 100644 index 9ca0572..0000000 --- a/api/errors/resource_error_reason.pb.go +++ /dev/null @@ -1,246 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 -// source: resource_error_reason.proto - -package errors - -import ( - _ "github.com/go-kratos/kratos/v2/errors" - 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) -) - -type Reason int32 - -const ( - Reason_NotFound Reason = 0 - Reason_Transform Reason = 1 - Reason_NoSupportStore Reason = 2 - Reason_System Reason = 3 - Reason_ChunkUpload Reason = 4 - Reason_Database Reason = 5 - Reason_StatusProgress Reason = 6 - Reason_UploadFile Reason = 7 - Reason_InitStore Reason = 8 - Reason_FileFormat Reason = 9 - Reason_AddDirectory Reason = 10 - Reason_UpdateDirectory Reason = 11 - Reason_DeleteDirectory Reason = 12 - Reason_NotExistFile Reason = 13 - Reason_AlreadyExistFileName Reason = 14 - Reason_NotExistDirectory Reason = 15 - Reason_NotExistResource Reason = 16 - Reason_Params Reason = 17 - Reason_AccessResource Reason = 18 - Reason_ExportFileNameDup Reason = 19 - Reason_ExportTaskProcess Reason = 20 - Reason_ResourceServer Reason = 21 -) - -// Enum value maps for Reason. -var ( - Reason_name = map[int32]string{ - 0: "NotFound", - 1: "Transform", - 2: "NoSupportStore", - 3: "System", - 4: "ChunkUpload", - 5: "Database", - 6: "StatusProgress", - 7: "UploadFile", - 8: "InitStore", - 9: "FileFormat", - 10: "AddDirectory", - 11: "UpdateDirectory", - 12: "DeleteDirectory", - 13: "NotExistFile", - 14: "AlreadyExistFileName", - 15: "NotExistDirectory", - 16: "NotExistResource", - 17: "Params", - 18: "AccessResource", - 19: "ExportFileNameDup", - 20: "ExportTaskProcess", - 21: "ResourceServer", - } - Reason_value = map[string]int32{ - "NotFound": 0, - "Transform": 1, - "NoSupportStore": 2, - "System": 3, - "ChunkUpload": 4, - "Database": 5, - "StatusProgress": 6, - "UploadFile": 7, - "InitStore": 8, - "FileFormat": 9, - "AddDirectory": 10, - "UpdateDirectory": 11, - "DeleteDirectory": 12, - "NotExistFile": 13, - "AlreadyExistFileName": 14, - "NotExistDirectory": 15, - "NotExistResource": 16, - "Params": 17, - "AccessResource": 18, - "ExportFileNameDup": 19, - "ExportTaskProcess": 20, - "ResourceServer": 21, - } -) - -func (x Reason) Enum() *Reason { - p := new(Reason) - *p = x - return p -} - -func (x Reason) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Reason) Descriptor() protoreflect.EnumDescriptor { - return file_resource_error_reason_proto_enumTypes[0].Descriptor() -} - -func (Reason) Type() protoreflect.EnumType { - return &file_resource_error_reason_proto_enumTypes[0] -} - -func (x Reason) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Reason.Descriptor instead. -func (Reason) EnumDescriptor() ([]byte, []int) { - return file_resource_error_reason_proto_rawDescGZIP(), []int{0} -} - -var File_resource_error_reason_proto protoreflect.FileDescriptor - -var file_resource_error_reason_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x76, - 0x31, 0x1a, 0x13, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a, 0xaa, 0x07, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x12, 0x20, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x00, 0x1a, - 0x12, 0xb2, 0x45, 0x0f, 0xe4, 0xb8, 0x8d, 0xe5, 0xad, 0x98, 0xe5, 0x9c, 0xa8, 0xe6, 0x95, 0xb0, - 0xe6, 0x8d, 0xae, 0x12, 0x24, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x10, 0x01, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe8, 0xbd, 0xac, - 0xe6, 0x8d, 0xa2, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x2f, 0x0a, 0x0e, 0x4e, 0x6f, 0x53, - 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x10, 0x02, 0x1a, 0x1b, 0xb2, - 0x45, 0x18, 0xe4, 0xb8, 0x8d, 0xe6, 0x94, 0xaf, 0xe6, 0x8c, 0x81, 0xe7, 0x9a, 0x84, 0xe5, 0xad, - 0x98, 0xe5, 0x82, 0xa8, 0xe5, 0xbc, 0x95, 0xe6, 0x93, 0x8e, 0x12, 0x1b, 0x0a, 0x06, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x10, 0x03, 0x1a, 0x0f, 0xb2, 0x45, 0x0c, 0xe7, 0xb3, 0xbb, 0xe7, 0xbb, - 0x9f, 0xe9, 0x94, 0x99, 0xe8, 0xaf, 0xaf, 0x12, 0x26, 0x0a, 0x0b, 0x43, 0x68, 0x75, 0x6e, 0x6b, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x04, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe5, 0x88, 0x86, - 0xe7, 0x89, 0x87, 0xe4, 0xb8, 0x8a, 0xe4, 0xbc, 0xa0, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, - 0x20, 0x0a, 0x08, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x10, 0x05, 0x1a, 0x12, 0xb2, - 0x45, 0x0f, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xba, 0x93, 0xe9, 0x94, 0x99, 0xe8, 0xaf, - 0xaf, 0x12, 0x26, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x72, 0x6f, 0x67, 0x72, - 0x65, 0x73, 0x73, 0x10, 0x06, 0x1a, 0x12, 0xb2, 0x45, 0x0f, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, - 0xe4, 0xb8, 0x8a, 0xe4, 0xbc, 0xa0, 0xe4, 0xb8, 0xad, 0x12, 0x25, 0x0a, 0x0a, 0x55, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x07, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x96, - 0x87, 0xe4, 0xbb, 0xb6, 0xe4, 0xb8, 0x8a, 0xe4, 0xbc, 0xa0, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, - 0x12, 0x2d, 0x0a, 0x09, 0x49, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x10, 0x08, 0x1a, - 0x1e, 0xb2, 0x45, 0x1b, 0xe5, 0xad, 0x98, 0xe5, 0x82, 0xa8, 0xe5, 0xbc, 0x95, 0xe6, 0x93, 0x8e, - 0xe5, 0x88, 0x9d, 0xe5, 0xa7, 0x8b, 0xe5, 0x8c, 0x96, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, - 0x25, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x10, 0x09, 0x1a, - 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe6, 0xa0, 0xbc, 0xe5, 0xbc, 0x8f, - 0xe9, 0x94, 0x99, 0xe8, 0xaf, 0xaf, 0x12, 0x27, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x44, 0x69, 0x72, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x10, 0x0a, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe7, 0x9b, 0xae, - 0xe5, 0xbd, 0x95, 0xe5, 0x88, 0x9b, 0xe5, 0xbb, 0xba, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, - 0x2a, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x10, 0x0b, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe7, 0x9b, 0xae, 0xe5, 0xbd, 0x95, 0xe6, - 0x9b, 0xb4, 0xe6, 0x96, 0xb0, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x2a, 0x0a, 0x0f, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x10, 0x0c, - 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe7, 0x9b, 0xae, 0xe5, 0xbd, 0x95, 0xe5, 0x88, 0xa0, 0xe9, 0x99, - 0xa4, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x24, 0x0a, 0x0c, 0x4e, 0x6f, 0x74, 0x45, 0x78, - 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x0d, 0x1a, 0x12, 0xb2, 0x45, 0x0f, 0xe6, 0x96, - 0x87, 0xe4, 0xbb, 0xb6, 0xe4, 0xb8, 0x8d, 0xe5, 0xad, 0x98, 0xe5, 0x9c, 0xa8, 0x12, 0x2f, 0x0a, - 0x14, 0x41, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x45, 0x78, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x10, 0x0e, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x96, 0x87, 0xe4, - 0xbb, 0xb6, 0xe5, 0x90, 0x8d, 0xe5, 0xb7, 0xb2, 0xe5, 0xad, 0x98, 0xe5, 0x9c, 0xa8, 0x12, 0x2c, - 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x79, 0x10, 0x0f, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, - 0xe5, 0xa4, 0xb9, 0xe4, 0xb8, 0x8d, 0xe5, 0xad, 0x98, 0xe5, 0x9c, 0xa8, 0x12, 0x28, 0x0a, 0x10, - 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x10, 0x10, 0x1a, 0x12, 0xb2, 0x45, 0x0f, 0xe8, 0xb5, 0x84, 0xe6, 0xba, 0x90, 0xe4, 0xb8, 0x8d, - 0xe5, 0xad, 0x98, 0xe5, 0x9c, 0xa8, 0x12, 0x1b, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x10, 0x11, 0x1a, 0x0f, 0xb2, 0x45, 0x0c, 0xe5, 0x8f, 0x82, 0xe6, 0x95, 0xb0, 0xe9, 0x94, 0x99, - 0xe8, 0xaf, 0xaf, 0x12, 0x2f, 0x0a, 0x0e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0x12, 0x1a, 0x1b, 0xb2, 0x45, 0x18, 0xe8, 0xae, 0xbf, 0xe9, - 0x97, 0xae, 0xe8, 0xb5, 0x84, 0xe6, 0xba, 0x90, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe5, 0xbc, - 0x82, 0xe5, 0xb8, 0xb8, 0x12, 0x35, 0x0a, 0x11, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, - 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x44, 0x75, 0x70, 0x10, 0x13, 0x1a, 0x1e, 0xb2, 0x45, 0x1b, - 0xe5, 0xaf, 0xbc, 0xe5, 0x87, 0xba, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe9, 0x87, 0x8d, 0xe5, - 0x91, 0xbd, 0xe5, 0x90, 0x8d, 0xe9, 0x87, 0x8d, 0xe5, 0xa4, 0x8d, 0x12, 0x35, 0x0a, 0x11, 0x45, - 0x78, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, - 0x10, 0x14, 0x1a, 0x1e, 0xb2, 0x45, 0x1b, 0xe5, 0xaf, 0xbc, 0xe5, 0x87, 0xba, 0xe4, 0xbb, 0xbb, - 0xe5, 0x8a, 0xa1, 0xe6, 0xad, 0xa3, 0xe5, 0x9c, 0xa8, 0xe8, 0xbf, 0x9b, 0xe8, 0xa1, 0x8c, 0xe4, - 0xb8, 0xad, 0x12, 0x29, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x10, 0x15, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe8, 0xb5, 0x84, 0xe6, 0xba, - 0x90, 0xe6, 0x9c, 0x8d, 0xe5, 0x8a, 0xa1, 0xe5, 0xbc, 0x82, 0xe5, 0xb8, 0xb8, 0x1a, 0x04, 0xa0, - 0x45, 0xf4, 0x03, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x3b, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_resource_error_reason_proto_rawDescOnce sync.Once - file_resource_error_reason_proto_rawDescData = file_resource_error_reason_proto_rawDesc -) - -func file_resource_error_reason_proto_rawDescGZIP() []byte { - file_resource_error_reason_proto_rawDescOnce.Do(func() { - file_resource_error_reason_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_error_reason_proto_rawDescData) - }) - return file_resource_error_reason_proto_rawDescData -} - -var file_resource_error_reason_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_resource_error_reason_proto_goTypes = []interface{}{ - (Reason)(0), // 0: v1.Reason -} -var file_resource_error_reason_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_resource_error_reason_proto_init() } -func file_resource_error_reason_proto_init() { - if File_resource_error_reason_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_resource_error_reason_proto_rawDesc, - NumEnums: 1, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_resource_error_reason_proto_goTypes, - DependencyIndexes: file_resource_error_reason_proto_depIdxs, - EnumInfos: file_resource_error_reason_proto_enumTypes, - }.Build() - File_resource_error_reason_proto = out.File - file_resource_error_reason_proto_rawDesc = nil - file_resource_error_reason_proto_goTypes = nil - file_resource_error_reason_proto_depIdxs = nil -} diff --git a/api/errors/resource_error_reason.pb.validate.go b/api/errors/resource_error_reason.pb.validate.go deleted file mode 100644 index f182769..0000000 --- a/api/errors/resource_error_reason.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: resource_error_reason.proto - -package errors - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/api/errors/resource_error_reason.proto b/api/errors/resource_error_reason.proto deleted file mode 100644 index 382a8be..0000000 --- a/api/errors/resource_error_reason.proto +++ /dev/null @@ -1,37 +0,0 @@ -syntax = "proto3"; - -package v1; - -import "errors/errors.proto"; -option go_package = "./;errors"; - - -enum Reason { - // 设置缺省错误码 - option (errors.default_code) = 500; - NotFound = 0[(errors.message) = "不存在数据"]; - Transform = 1[(errors.message)="数据转换失败"]; - NoSupportStore = 2[(errors.message)="不支持的存储引擎"]; - System =3 [(errors.message)="系统错误"]; - ChunkUpload = 4[(errors.message)="分片上传失败"]; - Database = 5[(errors.message)="数据库错误"]; - StatusProgress = 6[(errors.message)="文件上传中"]; - UploadFile = 7[(errors.message)="文件上传失败"]; - InitStore = 8[(errors.message)="存储引擎初始化失败"]; - FileFormat = 9[(errors.message)="文件格式错误"]; - AddDirectory = 10[(errors.message)="目录创建失败"]; - UpdateDirectory = 11[(errors.message)="目录更新失败"]; - DeleteDirectory = 12[(errors.message)="目录删除失败"]; - NotExistFile = 13[(errors.message)="文件不存在"]; - AlreadyExistFileName = 14[(errors.message)="文件名已存在"]; - NotExistDirectory = 15[(errors.message)="文件夹不存在"]; - NotExistResource = 16[(errors.message)="资源不存在"]; - Params = 17[(errors.message)="参数错误"]; - AccessResource = 18[(errors.message)="访问资源文件异常"]; - ExportFileNameDup = 19[(errors.message)="导出文件重命名重复"]; - ExportTaskProcess = 20[(errors.message)="导出任务正在进行中"]; - ResourceServer = 21[(errors.message)="资源服务异常"]; -} - - - diff --git a/api/errors/resource_error_reason_errors.pb.go b/api/errors/resource_error_reason_errors.pb.go deleted file mode 100644 index d2a1abb..0000000 --- a/api/errors/resource_error_reason_errors.pb.go +++ /dev/null @@ -1,364 +0,0 @@ -// Code generated by protoc-gen-go-errors. DO NOT EDIT. - -package errors - -import ( - fmt "fmt" - errors "github.com/go-kratos/kratos/v2/errors" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the kratos package it is being compiled against. -const _ = errors.SupportPackageIsVersion1 - -func IsNotFound(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_NotFound.String() && e.Code == 500 -} - -func NotFoundFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_NotFound.String(), "不存在数据:"+fmt.Sprintf(format, args...)) -} - -func NotFound() *errors.Error { - return errors.New(500, Reason_NotFound.String(), "不存在数据") -} - -func IsTransform(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_Transform.String() && e.Code == 500 -} - -func TransformFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_Transform.String(), "数据转换失败:"+fmt.Sprintf(format, args...)) -} - -func Transform() *errors.Error { - return errors.New(500, Reason_Transform.String(), "数据转换失败") -} - -func IsNoSupportStore(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_NoSupportStore.String() && e.Code == 500 -} - -func NoSupportStoreFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_NoSupportStore.String(), "不支持的存储引擎:"+fmt.Sprintf(format, args...)) -} - -func NoSupportStore() *errors.Error { - return errors.New(500, Reason_NoSupportStore.String(), "不支持的存储引擎") -} - -func IsSystem(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_System.String() && e.Code == 500 -} - -func SystemFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_System.String(), "系统错误:"+fmt.Sprintf(format, args...)) -} - -func System() *errors.Error { - return errors.New(500, Reason_System.String(), "系统错误") -} - -func IsChunkUpload(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_ChunkUpload.String() && e.Code == 500 -} - -func ChunkUploadFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_ChunkUpload.String(), "分片上传失败:"+fmt.Sprintf(format, args...)) -} - -func ChunkUpload() *errors.Error { - return errors.New(500, Reason_ChunkUpload.String(), "分片上传失败") -} - -func IsDatabase(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_Database.String() && e.Code == 500 -} - -func DatabaseFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_Database.String(), "数据库错误:"+fmt.Sprintf(format, args...)) -} - -func Database() *errors.Error { - return errors.New(500, Reason_Database.String(), "数据库错误") -} - -func IsStatusProgress(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_StatusProgress.String() && e.Code == 500 -} - -func StatusProgressFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_StatusProgress.String(), "文件上传中:"+fmt.Sprintf(format, args...)) -} - -func StatusProgress() *errors.Error { - return errors.New(500, Reason_StatusProgress.String(), "文件上传中") -} - -func IsUploadFile(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_UploadFile.String() && e.Code == 500 -} - -func UploadFileFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_UploadFile.String(), "文件上传失败:"+fmt.Sprintf(format, args...)) -} - -func UploadFile() *errors.Error { - return errors.New(500, Reason_UploadFile.String(), "文件上传失败") -} - -func IsInitStore(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_InitStore.String() && e.Code == 500 -} - -func InitStoreFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_InitStore.String(), "存储引擎初始化失败:"+fmt.Sprintf(format, args...)) -} - -func InitStore() *errors.Error { - return errors.New(500, Reason_InitStore.String(), "存储引擎初始化失败") -} - -func IsFileFormat(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_FileFormat.String() && e.Code == 500 -} - -func FileFormatFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_FileFormat.String(), "文件格式错误:"+fmt.Sprintf(format, args...)) -} - -func FileFormat() *errors.Error { - return errors.New(500, Reason_FileFormat.String(), "文件格式错误") -} - -func IsAddDirectory(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_AddDirectory.String() && e.Code == 500 -} - -func AddDirectoryFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_AddDirectory.String(), "目录创建失败:"+fmt.Sprintf(format, args...)) -} - -func AddDirectory() *errors.Error { - return errors.New(500, Reason_AddDirectory.String(), "目录创建失败") -} - -func IsUpdateDirectory(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_UpdateDirectory.String() && e.Code == 500 -} - -func UpdateDirectoryFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_UpdateDirectory.String(), "目录更新失败:"+fmt.Sprintf(format, args...)) -} - -func UpdateDirectory() *errors.Error { - return errors.New(500, Reason_UpdateDirectory.String(), "目录更新失败") -} - -func IsDeleteDirectory(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_DeleteDirectory.String() && e.Code == 500 -} - -func DeleteDirectoryFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_DeleteDirectory.String(), "目录删除失败:"+fmt.Sprintf(format, args...)) -} - -func DeleteDirectory() *errors.Error { - return errors.New(500, Reason_DeleteDirectory.String(), "目录删除失败") -} - -func IsNotExistFile(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_NotExistFile.String() && e.Code == 500 -} - -func NotExistFileFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_NotExistFile.String(), "文件不存在:"+fmt.Sprintf(format, args...)) -} - -func NotExistFile() *errors.Error { - return errors.New(500, Reason_NotExistFile.String(), "文件不存在") -} - -func IsAlreadyExistFileName(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_AlreadyExistFileName.String() && e.Code == 500 -} - -func AlreadyExistFileNameFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_AlreadyExistFileName.String(), "文件名已存在:"+fmt.Sprintf(format, args...)) -} - -func AlreadyExistFileName() *errors.Error { - return errors.New(500, Reason_AlreadyExistFileName.String(), "文件名已存在") -} - -func IsNotExistDirectory(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_NotExistDirectory.String() && e.Code == 500 -} - -func NotExistDirectoryFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_NotExistDirectory.String(), "文件夹不存在:"+fmt.Sprintf(format, args...)) -} - -func NotExistDirectory() *errors.Error { - return errors.New(500, Reason_NotExistDirectory.String(), "文件夹不存在") -} - -func IsNotExistResource(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_NotExistResource.String() && e.Code == 500 -} - -func NotExistResourceFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_NotExistResource.String(), "资源不存在:"+fmt.Sprintf(format, args...)) -} - -func NotExistResource() *errors.Error { - return errors.New(500, Reason_NotExistResource.String(), "资源不存在") -} - -func IsParams(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_Params.String() && e.Code == 500 -} - -func ParamsFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_Params.String(), "参数错误:"+fmt.Sprintf(format, args...)) -} - -func Params() *errors.Error { - return errors.New(500, Reason_Params.String(), "参数错误") -} - -func IsAccessResource(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_AccessResource.String() && e.Code == 500 -} - -func AccessResourceFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_AccessResource.String(), "访问资源文件异常:"+fmt.Sprintf(format, args...)) -} - -func AccessResource() *errors.Error { - return errors.New(500, Reason_AccessResource.String(), "访问资源文件异常") -} - -func IsExportFileNameDup(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_ExportFileNameDup.String() && e.Code == 500 -} - -func ExportFileNameDupFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_ExportFileNameDup.String(), "导出文件重命名重复:"+fmt.Sprintf(format, args...)) -} - -func ExportFileNameDup() *errors.Error { - return errors.New(500, Reason_ExportFileNameDup.String(), "导出文件重命名重复") -} - -func IsExportTaskProcess(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_ExportTaskProcess.String() && e.Code == 500 -} - -func ExportTaskProcessFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_ExportTaskProcess.String(), "导出任务正在进行中:"+fmt.Sprintf(format, args...)) -} - -func ExportTaskProcess() *errors.Error { - return errors.New(500, Reason_ExportTaskProcess.String(), "导出任务正在进行中") -} - -func IsResourceServer(err error) bool { - if err == nil { - return false - } - e := errors.FromError(err) - return e.Reason == Reason_ResourceServer.String() && e.Code == 500 -} - -func ResourceServerFormat(format string, args ...any) *errors.Error { - return errors.New(500, Reason_ResourceServer.String(), "资源服务异常:"+fmt.Sprintf(format, args...)) -} - -func ResourceServer() *errors.Error { - return errors.New(500, Reason_ResourceServer.String(), "资源服务异常") -} diff --git a/api/export/resource_export.proto b/api/export/resource_export.proto deleted file mode 100644 index d1cc553..0000000 --- a/api/export/resource_export.proto +++ /dev/null @@ -1,62 +0,0 @@ -syntax = "proto3"; - -package export; -option go_package = "./v1;v1"; -import "google/api/annotations.proto"; -import "validate/validate.proto"; - -message Export{ - uint32 id = 1; - string name = 2; - uint32 size = 3; - string src = 4; - string version = 5; - string reason = 6; - string status = 7; - uint32 created_at = 8; - uint32 updated_at = 9; -} - -message PageExportRequest{ - uint32 page = 1[(validate.rules).uint32 = {gt:0}]; - uint32 page_size = 2[(validate.rules).uint32 = {gt:0,lte:100}]; -} - -message PageExportReply{ - repeated Export list = 1; - optional uint32 total = 2; -} - - -message AddExportRequest{ - message ExportFile{ - string sha = 1; - string rename = 2; - } - string name = 1[(validate.rules).string = {min_len:1}]; - repeated ExportFile files = 2; - repeated uint32 ids = 3; -} -message AddExportReply{ - uint32 id = 1; -} - -message AddExportExcelRequest{ - message Col{ - string type = 1[(validate.rules).string = {min_len:1}]; - string value = 2; - } - message Row{ - repeated Col cols = 1; - } - string name = 1[(validate.rules).string = {min_len:1}]; - repeated Row rows = 2[(validate.rules).repeated = {min_items:1}]; -} - -message AddExportExcelReply{ - uint32 id = 1; -} - -message DeleteExportRequest{ - uint32 id = 1; -} diff --git a/api/export/resource_export_service.proto b/api/export/resource_export_service.proto deleted file mode 100644 index cc64545..0000000 --- a/api/export/resource_export_service.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -package export; -option go_package = "./v1;v1"; - -import "google/api/annotations.proto"; -import "google/protobuf/empty.proto"; - -import "resource_export.proto"; - -service Service { - - rpc PageExport (PageExportRequest) returns (PageExportReply) { - option (google.api.http) = { - get: "/resource/v1/exports" - }; - } - - rpc AddExport (AddExportRequest) returns (AddExportReply) { - option (google.api.http) = { - post: "/resource/v1/export", - body:"*" - }; - } - - rpc AddExportExcel (AddExportExcelRequest) returns (AddExportExcelReply) { - option (google.api.http) = { - post: "/resource/v1/export/excel", - body:"*" - }; - } - - rpc DeleteExport (DeleteExportRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/resource/v1/export" - }; - } -} - - diff --git a/api/export/v1/resource_export.pb.go b/api/export/v1/resource_export.pb.go deleted file mode 100644 index 9280c01..0000000 --- a/api/export/v1/resource_export.pb.go +++ /dev/null @@ -1,929 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 -// source: resource_export.proto - -package v1 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - _ "google.golang.org/genproto/googleapis/api/annotations" - 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) -) - -type Export struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Size uint32 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` - Src string `protobuf:"bytes,4,opt,name=src,proto3" json:"src,omitempty"` - Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` - Reason string `protobuf:"bytes,6,opt,name=reason,proto3" json:"reason,omitempty"` - Status string `protobuf:"bytes,7,opt,name=status,proto3" json:"status,omitempty"` - CreatedAt uint32 `protobuf:"varint,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - UpdatedAt uint32 `protobuf:"varint,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` -} - -func (x *Export) Reset() { - *x = Export{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Export) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Export) ProtoMessage() {} - -func (x *Export) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_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 Export.ProtoReflect.Descriptor instead. -func (*Export) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{0} -} - -func (x *Export) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Export) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Export) GetSize() uint32 { - if x != nil { - return x.Size - } - return 0 -} - -func (x *Export) GetSrc() string { - if x != nil { - return x.Src - } - return "" -} - -func (x *Export) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Export) GetReason() string { - if x != nil { - return x.Reason - } - return "" -} - -func (x *Export) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *Export) GetCreatedAt() uint32 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *Export) GetUpdatedAt() uint32 { - if x != nil { - return x.UpdatedAt - } - return 0 -} - -type PageExportRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Page uint32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` - PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` -} - -func (x *PageExportRequest) Reset() { - *x = PageExportRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PageExportRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PageExportRequest) ProtoMessage() {} - -func (x *PageExportRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[1] - 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 PageExportRequest.ProtoReflect.Descriptor instead. -func (*PageExportRequest) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{1} -} - -func (x *PageExportRequest) GetPage() uint32 { - if x != nil { - return x.Page - } - return 0 -} - -func (x *PageExportRequest) GetPageSize() uint32 { - if x != nil { - return x.PageSize - } - return 0 -} - -type PageExportReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - List []*Export `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total *uint32 `protobuf:"varint,2,opt,name=total,proto3,oneof" json:"total,omitempty"` -} - -func (x *PageExportReply) Reset() { - *x = PageExportReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PageExportReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PageExportReply) ProtoMessage() {} - -func (x *PageExportReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[2] - 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 PageExportReply.ProtoReflect.Descriptor instead. -func (*PageExportReply) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{2} -} - -func (x *PageExportReply) GetList() []*Export { - if x != nil { - return x.List - } - return nil -} - -func (x *PageExportReply) GetTotal() uint32 { - if x != nil && x.Total != nil { - return *x.Total - } - return 0 -} - -type AddExportRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Files []*AddExportRequest_ExportFile `protobuf:"bytes,2,rep,name=files,proto3" json:"files,omitempty"` - Ids []uint32 `protobuf:"varint,3,rep,packed,name=ids,proto3" json:"ids,omitempty"` -} - -func (x *AddExportRequest) Reset() { - *x = AddExportRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddExportRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddExportRequest) ProtoMessage() {} - -func (x *AddExportRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[3] - 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 AddExportRequest.ProtoReflect.Descriptor instead. -func (*AddExportRequest) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{3} -} - -func (x *AddExportRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AddExportRequest) GetFiles() []*AddExportRequest_ExportFile { - if x != nil { - return x.Files - } - return nil -} - -func (x *AddExportRequest) GetIds() []uint32 { - if x != nil { - return x.Ids - } - return nil -} - -type AddExportReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *AddExportReply) Reset() { - *x = AddExportReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddExportReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddExportReply) ProtoMessage() {} - -func (x *AddExportReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[4] - 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 AddExportReply.ProtoReflect.Descriptor instead. -func (*AddExportReply) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{4} -} - -func (x *AddExportReply) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type AddExportExcelRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Rows []*AddExportExcelRequest_Row `protobuf:"bytes,2,rep,name=rows,proto3" json:"rows,omitempty"` -} - -func (x *AddExportExcelRequest) Reset() { - *x = AddExportExcelRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddExportExcelRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddExportExcelRequest) ProtoMessage() {} - -func (x *AddExportExcelRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[5] - 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 AddExportExcelRequest.ProtoReflect.Descriptor instead. -func (*AddExportExcelRequest) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{5} -} - -func (x *AddExportExcelRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AddExportExcelRequest) GetRows() []*AddExportExcelRequest_Row { - if x != nil { - return x.Rows - } - return nil -} - -type AddExportExcelReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *AddExportExcelReply) Reset() { - *x = AddExportExcelReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddExportExcelReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddExportExcelReply) ProtoMessage() {} - -func (x *AddExportExcelReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[6] - 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 AddExportExcelReply.ProtoReflect.Descriptor instead. -func (*AddExportExcelReply) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{6} -} - -func (x *AddExportExcelReply) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type DeleteExportRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *DeleteExportRequest) Reset() { - *x = DeleteExportRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteExportRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteExportRequest) ProtoMessage() {} - -func (x *DeleteExportRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[7] - 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 DeleteExportRequest.ProtoReflect.Descriptor instead. -func (*DeleteExportRequest) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{7} -} - -func (x *DeleteExportRequest) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type AddExportRequest_ExportFile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sha string `protobuf:"bytes,1,opt,name=sha,proto3" json:"sha,omitempty"` - Rename string `protobuf:"bytes,2,opt,name=rename,proto3" json:"rename,omitempty"` -} - -func (x *AddExportRequest_ExportFile) Reset() { - *x = AddExportRequest_ExportFile{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddExportRequest_ExportFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddExportRequest_ExportFile) ProtoMessage() {} - -func (x *AddExportRequest_ExportFile) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[8] - 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 AddExportRequest_ExportFile.ProtoReflect.Descriptor instead. -func (*AddExportRequest_ExportFile) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{3, 0} -} - -func (x *AddExportRequest_ExportFile) GetSha() string { - if x != nil { - return x.Sha - } - return "" -} - -func (x *AddExportRequest_ExportFile) GetRename() string { - if x != nil { - return x.Rename - } - return "" -} - -type AddExportExcelRequest_Col struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *AddExportExcelRequest_Col) Reset() { - *x = AddExportExcelRequest_Col{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddExportExcelRequest_Col) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddExportExcelRequest_Col) ProtoMessage() {} - -func (x *AddExportExcelRequest_Col) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[9] - 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 AddExportExcelRequest_Col.ProtoReflect.Descriptor instead. -func (*AddExportExcelRequest_Col) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{5, 0} -} - -func (x *AddExportExcelRequest_Col) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *AddExportExcelRequest_Col) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type AddExportExcelRequest_Row struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Cols []*AddExportExcelRequest_Col `protobuf:"bytes,1,rep,name=cols,proto3" json:"cols,omitempty"` -} - -func (x *AddExportExcelRequest_Row) Reset() { - *x = AddExportExcelRequest_Row{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_export_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddExportExcelRequest_Row) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddExportExcelRequest_Row) ProtoMessage() {} - -func (x *AddExportExcelRequest_Row) ProtoReflect() protoreflect.Message { - mi := &file_resource_export_proto_msgTypes[10] - 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 AddExportExcelRequest_Row.ProtoReflect.Descriptor instead. -func (*AddExportExcelRequest_Row) Descriptor() ([]byte, []int) { - return file_resource_export_proto_rawDescGZIP(), []int{5, 1} -} - -func (x *AddExportExcelRequest_Row) GetCols() []*AddExportExcelRequest_Col { - if x != nil { - return x.Cols - } - return nil -} - -var File_resource_export_proto protoreflect.FileDescriptor - -var file_resource_export_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x1a, - 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x01, 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x72, 0x63, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x72, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x64, 0x41, 0x74, 0x22, 0x58, 0x0a, 0x11, 0x50, 0x61, 0x67, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, - 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x26, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, - 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x2a, 0x04, 0x18, - 0x64, 0x20, 0x00, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x5a, 0x0a, - 0x0f, 0x50, 0x61, 0x67, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x12, 0x22, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x04, - 0x6c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xb4, 0x01, 0x0a, 0x10, 0x41, 0x64, - 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x78, 0x70, - 0x6f, 0x72, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, - 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0d, 0x52, 0x03, 0x69, 0x64, 0x73, 0x1a, 0x36, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x6f, - 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, - 0x22, 0x20, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, - 0x69, 0x64, 0x22, 0xed, 0x01, 0x0a, 0x15, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, - 0x45, 0x78, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x72, 0x6f, 0x77, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, - 0x2e, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x78, 0x63, 0x65, 0x6c, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x6f, 0x77, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, - 0x01, 0x02, 0x08, 0x01, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x1a, 0x38, 0x0a, 0x03, 0x43, 0x6f, - 0x6c, 0x12, 0x1b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x3c, 0x0a, 0x03, 0x52, 0x6f, 0x77, 0x12, 0x35, 0x0a, 0x04, 0x63, - 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x78, 0x70, 0x6f, - 0x72, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x78, 0x63, 0x65, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6c, 0x52, 0x04, 0x63, 0x6f, - 0x6c, 0x73, 0x22, 0x25, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x45, - 0x78, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x25, 0x0a, 0x13, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, - 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_resource_export_proto_rawDescOnce sync.Once - file_resource_export_proto_rawDescData = file_resource_export_proto_rawDesc -) - -func file_resource_export_proto_rawDescGZIP() []byte { - file_resource_export_proto_rawDescOnce.Do(func() { - file_resource_export_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_export_proto_rawDescData) - }) - return file_resource_export_proto_rawDescData -} - -var file_resource_export_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_resource_export_proto_goTypes = []interface{}{ - (*Export)(nil), // 0: export.Export - (*PageExportRequest)(nil), // 1: export.PageExportRequest - (*PageExportReply)(nil), // 2: export.PageExportReply - (*AddExportRequest)(nil), // 3: export.AddExportRequest - (*AddExportReply)(nil), // 4: export.AddExportReply - (*AddExportExcelRequest)(nil), // 5: export.AddExportExcelRequest - (*AddExportExcelReply)(nil), // 6: export.AddExportExcelReply - (*DeleteExportRequest)(nil), // 7: export.DeleteExportRequest - (*AddExportRequest_ExportFile)(nil), // 8: export.AddExportRequest.ExportFile - (*AddExportExcelRequest_Col)(nil), // 9: export.AddExportExcelRequest.Col - (*AddExportExcelRequest_Row)(nil), // 10: export.AddExportExcelRequest.Row -} -var file_resource_export_proto_depIdxs = []int32{ - 0, // 0: export.PageExportReply.list:type_name -> export.Export - 8, // 1: export.AddExportRequest.files:type_name -> export.AddExportRequest.ExportFile - 10, // 2: export.AddExportExcelRequest.rows:type_name -> export.AddExportExcelRequest.Row - 9, // 3: export.AddExportExcelRequest.Row.cols:type_name -> export.AddExportExcelRequest.Col - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_resource_export_proto_init() } -func file_resource_export_proto_init() { - if File_resource_export_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_resource_export_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Export); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PageExportRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PageExportReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddExportRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddExportReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddExportExcelRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddExportExcelReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteExportRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddExportRequest_ExportFile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddExportExcelRequest_Col); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_export_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddExportExcelRequest_Row); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_resource_export_proto_msgTypes[2].OneofWrappers = []interface{}{} - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_resource_export_proto_rawDesc, - NumEnums: 0, - NumMessages: 11, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_resource_export_proto_goTypes, - DependencyIndexes: file_resource_export_proto_depIdxs, - MessageInfos: file_resource_export_proto_msgTypes, - }.Build() - File_resource_export_proto = out.File - file_resource_export_proto_rawDesc = nil - file_resource_export_proto_goTypes = nil - file_resource_export_proto_depIdxs = nil -} diff --git a/api/export/v1/resource_export.pb.validate.go b/api/export/v1/resource_export.pb.validate.go deleted file mode 100644 index 82e3f1f..0000000 --- a/api/export/v1/resource_export.pb.validate.go +++ /dev/null @@ -1,1385 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: resource_export.proto - -package v1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Export with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Export) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Export with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in ExportMultiError, or nil if none found. -func (m *Export) ValidateAll() error { - return m.validate(true) -} - -func (m *Export) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Name - - // no validation rules for Size - - // no validation rules for Src - - // no validation rules for Version - - // no validation rules for Reason - - // no validation rules for Status - - // no validation rules for CreatedAt - - // no validation rules for UpdatedAt - - if len(errors) > 0 { - return ExportMultiError(errors) - } - - return nil -} - -// ExportMultiError is an error wrapping multiple validation errors returned by -// Export.ValidateAll() if the designated constraints aren't met. -type ExportMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExportMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExportMultiError) AllErrors() []error { return m } - -// ExportValidationError is the validation error returned by Export.Validate if -// the designated constraints aren't met. -type ExportValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExportValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExportValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExportValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExportValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExportValidationError) ErrorName() string { return "ExportValidationError" } - -// Error satisfies the builtin error interface -func (e ExportValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExport.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExportValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExportValidationError{} - -// Validate checks the field values on PageExportRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *PageExportRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PageExportRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// PageExportRequestMultiError, or nil if none found. -func (m *PageExportRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *PageExportRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetPage() <= 0 { - err := PageExportRequestValidationError{ - field: "Page", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - if val := m.GetPageSize(); val <= 0 || val > 100 { - err := PageExportRequestValidationError{ - field: "PageSize", - reason: "value must be inside range (0, 100]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return PageExportRequestMultiError(errors) - } - - return nil -} - -// PageExportRequestMultiError is an error wrapping multiple validation errors -// returned by PageExportRequest.ValidateAll() if the designated constraints -// aren't met. -type PageExportRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PageExportRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PageExportRequestMultiError) AllErrors() []error { return m } - -// PageExportRequestValidationError is the validation error returned by -// PageExportRequest.Validate if the designated constraints aren't met. -type PageExportRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PageExportRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PageExportRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PageExportRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PageExportRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PageExportRequestValidationError) ErrorName() string { - return "PageExportRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e PageExportRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPageExportRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PageExportRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PageExportRequestValidationError{} - -// Validate checks the field values on PageExportReply with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *PageExportReply) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PageExportReply with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// PageExportReplyMultiError, or nil if none found. -func (m *PageExportReply) ValidateAll() error { - return m.validate(true) -} - -func (m *PageExportReply) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetList() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PageExportReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PageExportReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PageExportReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if m.Total != nil { - // no validation rules for Total - } - - if len(errors) > 0 { - return PageExportReplyMultiError(errors) - } - - return nil -} - -// PageExportReplyMultiError is an error wrapping multiple validation errors -// returned by PageExportReply.ValidateAll() if the designated constraints -// aren't met. -type PageExportReplyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PageExportReplyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PageExportReplyMultiError) AllErrors() []error { return m } - -// PageExportReplyValidationError is the validation error returned by -// PageExportReply.Validate if the designated constraints aren't met. -type PageExportReplyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PageExportReplyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PageExportReplyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PageExportReplyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PageExportReplyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PageExportReplyValidationError) ErrorName() string { return "PageExportReplyValidationError" } - -// Error satisfies the builtin error interface -func (e PageExportReplyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPageExportReply.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PageExportReplyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PageExportReplyValidationError{} - -// Validate checks the field values on AddExportRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *AddExportRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddExportRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddExportRequestMultiError, or nil if none found. -func (m *AddExportRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AddExportRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := AddExportRequestValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetFiles() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddExportRequestValidationError{ - field: fmt.Sprintf("Files[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddExportRequestValidationError{ - field: fmt.Sprintf("Files[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddExportRequestValidationError{ - field: fmt.Sprintf("Files[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return AddExportRequestMultiError(errors) - } - - return nil -} - -// AddExportRequestMultiError is an error wrapping multiple validation errors -// returned by AddExportRequest.ValidateAll() if the designated constraints -// aren't met. -type AddExportRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddExportRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddExportRequestMultiError) AllErrors() []error { return m } - -// AddExportRequestValidationError is the validation error returned by -// AddExportRequest.Validate if the designated constraints aren't met. -type AddExportRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddExportRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddExportRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddExportRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddExportRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddExportRequestValidationError) ErrorName() string { return "AddExportRequestValidationError" } - -// Error satisfies the builtin error interface -func (e AddExportRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddExportRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddExportRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddExportRequestValidationError{} - -// Validate checks the field values on AddExportReply with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AddExportReply) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddExportReply with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AddExportReplyMultiError, -// or nil if none found. -func (m *AddExportReply) ValidateAll() error { - return m.validate(true) -} - -func (m *AddExportReply) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return AddExportReplyMultiError(errors) - } - - return nil -} - -// AddExportReplyMultiError is an error wrapping multiple validation errors -// returned by AddExportReply.ValidateAll() if the designated constraints -// aren't met. -type AddExportReplyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddExportReplyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddExportReplyMultiError) AllErrors() []error { return m } - -// AddExportReplyValidationError is the validation error returned by -// AddExportReply.Validate if the designated constraints aren't met. -type AddExportReplyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddExportReplyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddExportReplyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddExportReplyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddExportReplyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddExportReplyValidationError) ErrorName() string { return "AddExportReplyValidationError" } - -// Error satisfies the builtin error interface -func (e AddExportReplyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddExportReply.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddExportReplyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddExportReplyValidationError{} - -// Validate checks the field values on AddExportExcelRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AddExportExcelRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddExportExcelRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddExportExcelRequestMultiError, or nil if none found. -func (m *AddExportExcelRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AddExportExcelRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := AddExportExcelRequestValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(m.GetRows()) < 1 { - err := AddExportExcelRequestValidationError{ - field: "Rows", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - for idx, item := range m.GetRows() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddExportExcelRequestValidationError{ - field: fmt.Sprintf("Rows[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddExportExcelRequestValidationError{ - field: fmt.Sprintf("Rows[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddExportExcelRequestValidationError{ - field: fmt.Sprintf("Rows[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return AddExportExcelRequestMultiError(errors) - } - - return nil -} - -// AddExportExcelRequestMultiError is an error wrapping multiple validation -// errors returned by AddExportExcelRequest.ValidateAll() if the designated -// constraints aren't met. -type AddExportExcelRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddExportExcelRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddExportExcelRequestMultiError) AllErrors() []error { return m } - -// AddExportExcelRequestValidationError is the validation error returned by -// AddExportExcelRequest.Validate if the designated constraints aren't met. -type AddExportExcelRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddExportExcelRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddExportExcelRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddExportExcelRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddExportExcelRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddExportExcelRequestValidationError) ErrorName() string { - return "AddExportExcelRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e AddExportExcelRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddExportExcelRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddExportExcelRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddExportExcelRequestValidationError{} - -// Validate checks the field values on AddExportExcelReply with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AddExportExcelReply) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddExportExcelReply with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddExportExcelReplyMultiError, or nil if none found. -func (m *AddExportExcelReply) ValidateAll() error { - return m.validate(true) -} - -func (m *AddExportExcelReply) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return AddExportExcelReplyMultiError(errors) - } - - return nil -} - -// AddExportExcelReplyMultiError is an error wrapping multiple validation -// errors returned by AddExportExcelReply.ValidateAll() if the designated -// constraints aren't met. -type AddExportExcelReplyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddExportExcelReplyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddExportExcelReplyMultiError) AllErrors() []error { return m } - -// AddExportExcelReplyValidationError is the validation error returned by -// AddExportExcelReply.Validate if the designated constraints aren't met. -type AddExportExcelReplyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddExportExcelReplyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddExportExcelReplyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddExportExcelReplyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddExportExcelReplyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddExportExcelReplyValidationError) ErrorName() string { - return "AddExportExcelReplyValidationError" -} - -// Error satisfies the builtin error interface -func (e AddExportExcelReplyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddExportExcelReply.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddExportExcelReplyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddExportExcelReplyValidationError{} - -// Validate checks the field values on DeleteExportRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteExportRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteExportRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteExportRequestMultiError, or nil if none found. -func (m *DeleteExportRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteExportRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - if len(errors) > 0 { - return DeleteExportRequestMultiError(errors) - } - - return nil -} - -// DeleteExportRequestMultiError is an error wrapping multiple validation -// errors returned by DeleteExportRequest.ValidateAll() if the designated -// constraints aren't met. -type DeleteExportRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteExportRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteExportRequestMultiError) AllErrors() []error { return m } - -// DeleteExportRequestValidationError is the validation error returned by -// DeleteExportRequest.Validate if the designated constraints aren't met. -type DeleteExportRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteExportRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteExportRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteExportRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteExportRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteExportRequestValidationError) ErrorName() string { - return "DeleteExportRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteExportRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteExportRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteExportRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteExportRequestValidationError{} - -// Validate checks the field values on AddExportRequest_ExportFile with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AddExportRequest_ExportFile) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddExportRequest_ExportFile with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddExportRequest_ExportFileMultiError, or nil if none found. -func (m *AddExportRequest_ExportFile) ValidateAll() error { - return m.validate(true) -} - -func (m *AddExportRequest_ExportFile) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Sha - - // no validation rules for Rename - - if len(errors) > 0 { - return AddExportRequest_ExportFileMultiError(errors) - } - - return nil -} - -// AddExportRequest_ExportFileMultiError is an error wrapping multiple -// validation errors returned by AddExportRequest_ExportFile.ValidateAll() if -// the designated constraints aren't met. -type AddExportRequest_ExportFileMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddExportRequest_ExportFileMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddExportRequest_ExportFileMultiError) AllErrors() []error { return m } - -// AddExportRequest_ExportFileValidationError is the validation error returned -// by AddExportRequest_ExportFile.Validate if the designated constraints -// aren't met. -type AddExportRequest_ExportFileValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddExportRequest_ExportFileValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddExportRequest_ExportFileValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddExportRequest_ExportFileValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddExportRequest_ExportFileValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddExportRequest_ExportFileValidationError) ErrorName() string { - return "AddExportRequest_ExportFileValidationError" -} - -// Error satisfies the builtin error interface -func (e AddExportRequest_ExportFileValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddExportRequest_ExportFile.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddExportRequest_ExportFileValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddExportRequest_ExportFileValidationError{} - -// Validate checks the field values on AddExportExcelRequest_Col with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AddExportExcelRequest_Col) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddExportExcelRequest_Col with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddExportExcelRequest_ColMultiError, or nil if none found. -func (m *AddExportExcelRequest_Col) ValidateAll() error { - return m.validate(true) -} - -func (m *AddExportExcelRequest_Col) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetType()) < 1 { - err := AddExportExcelRequest_ColValidationError{ - field: "Type", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Value - - if len(errors) > 0 { - return AddExportExcelRequest_ColMultiError(errors) - } - - return nil -} - -// AddExportExcelRequest_ColMultiError is an error wrapping multiple validation -// errors returned by AddExportExcelRequest_Col.ValidateAll() if the -// designated constraints aren't met. -type AddExportExcelRequest_ColMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddExportExcelRequest_ColMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddExportExcelRequest_ColMultiError) AllErrors() []error { return m } - -// AddExportExcelRequest_ColValidationError is the validation error returned by -// AddExportExcelRequest_Col.Validate if the designated constraints aren't met. -type AddExportExcelRequest_ColValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddExportExcelRequest_ColValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddExportExcelRequest_ColValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddExportExcelRequest_ColValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddExportExcelRequest_ColValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddExportExcelRequest_ColValidationError) ErrorName() string { - return "AddExportExcelRequest_ColValidationError" -} - -// Error satisfies the builtin error interface -func (e AddExportExcelRequest_ColValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddExportExcelRequest_Col.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddExportExcelRequest_ColValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddExportExcelRequest_ColValidationError{} - -// Validate checks the field values on AddExportExcelRequest_Row with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AddExportExcelRequest_Row) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddExportExcelRequest_Row with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddExportExcelRequest_RowMultiError, or nil if none found. -func (m *AddExportExcelRequest_Row) ValidateAll() error { - return m.validate(true) -} - -func (m *AddExportExcelRequest_Row) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetCols() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddExportExcelRequest_RowValidationError{ - field: fmt.Sprintf("Cols[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddExportExcelRequest_RowValidationError{ - field: fmt.Sprintf("Cols[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddExportExcelRequest_RowValidationError{ - field: fmt.Sprintf("Cols[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return AddExportExcelRequest_RowMultiError(errors) - } - - return nil -} - -// AddExportExcelRequest_RowMultiError is an error wrapping multiple validation -// errors returned by AddExportExcelRequest_Row.ValidateAll() if the -// designated constraints aren't met. -type AddExportExcelRequest_RowMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddExportExcelRequest_RowMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddExportExcelRequest_RowMultiError) AllErrors() []error { return m } - -// AddExportExcelRequest_RowValidationError is the validation error returned by -// AddExportExcelRequest_Row.Validate if the designated constraints aren't met. -type AddExportExcelRequest_RowValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddExportExcelRequest_RowValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddExportExcelRequest_RowValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddExportExcelRequest_RowValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddExportExcelRequest_RowValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddExportExcelRequest_RowValidationError) ErrorName() string { - return "AddExportExcelRequest_RowValidationError" -} - -// Error satisfies the builtin error interface -func (e AddExportExcelRequest_RowValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddExportExcelRequest_Row.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddExportExcelRequest_RowValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddExportExcelRequest_RowValidationError{} diff --git a/api/export/v1/resource_export_service.pb.go b/api/export/v1/resource_export_service.pb.go deleted file mode 100644 index 0daad5d..0000000 --- a/api/export/v1/resource_export_service.pb.go +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 -// source: resource_export_service.proto - -package v1 - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" -) - -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) -) - -var File_resource_export_service_proto protoreflect.FileDescriptor - -var file_resource_export_service_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x06, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x78, 0x70, - 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x9e, 0x03, 0x0a, 0x07, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x50, 0x61, 0x67, 0x65, 0x45, 0x78, 0x70, - 0x6f, 0x72, 0x74, 0x12, 0x19, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x50, 0x61, 0x67, - 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, - 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x45, 0x78, 0x70, 0x6f, - 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, - 0x14, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, - 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x5d, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, - 0x72, 0x74, 0x12, 0x18, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x45, - 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x65, - 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x3a, 0x01, 0x2a, 0x22, - 0x13, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, - 0x70, 0x6f, 0x72, 0x74, 0x12, 0x72, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x45, 0x78, 0x63, 0x65, 0x6c, 0x12, 0x1d, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, - 0x41, 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x78, 0x63, 0x65, 0x6c, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x41, - 0x64, 0x64, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x78, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x01, 0x2a, 0x22, 0x19, 0x2f, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, - 0x72, 0x74, 0x2f, 0x65, 0x78, 0x63, 0x65, 0x6c, 0x12, 0x60, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1b, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, - 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1b, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x2a, 0x13, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, - 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_resource_export_service_proto_goTypes = []interface{}{ - (*PageExportRequest)(nil), // 0: export.PageExportRequest - (*AddExportRequest)(nil), // 1: export.AddExportRequest - (*AddExportExcelRequest)(nil), // 2: export.AddExportExcelRequest - (*DeleteExportRequest)(nil), // 3: export.DeleteExportRequest - (*PageExportReply)(nil), // 4: export.PageExportReply - (*AddExportReply)(nil), // 5: export.AddExportReply - (*AddExportExcelReply)(nil), // 6: export.AddExportExcelReply - (*emptypb.Empty)(nil), // 7: google.protobuf.Empty -} -var file_resource_export_service_proto_depIdxs = []int32{ - 0, // 0: export.Service.PageExport:input_type -> export.PageExportRequest - 1, // 1: export.Service.AddExport:input_type -> export.AddExportRequest - 2, // 2: export.Service.AddExportExcel:input_type -> export.AddExportExcelRequest - 3, // 3: export.Service.DeleteExport:input_type -> export.DeleteExportRequest - 4, // 4: export.Service.PageExport:output_type -> export.PageExportReply - 5, // 5: export.Service.AddExport:output_type -> export.AddExportReply - 6, // 6: export.Service.AddExportExcel:output_type -> export.AddExportExcelReply - 7, // 7: export.Service.DeleteExport:output_type -> google.protobuf.Empty - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] 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_resource_export_service_proto_init() } -func file_resource_export_service_proto_init() { - if File_resource_export_service_proto != nil { - return - } - file_resource_export_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_resource_export_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_resource_export_service_proto_goTypes, - DependencyIndexes: file_resource_export_service_proto_depIdxs, - }.Build() - File_resource_export_service_proto = out.File - file_resource_export_service_proto_rawDesc = nil - file_resource_export_service_proto_goTypes = nil - file_resource_export_service_proto_depIdxs = nil -} diff --git a/api/export/v1/resource_export_service.pb.validate.go b/api/export/v1/resource_export_service.pb.validate.go deleted file mode 100644 index 56fd243..0000000 --- a/api/export/v1/resource_export_service.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: resource_export_service.proto - -package v1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/api/export/v1/resource_export_service_grpc.pb.go b/api/export/v1/resource_export_service_grpc.pb.go deleted file mode 100644 index 2ada29a..0000000 --- a/api/export/v1/resource_export_service_grpc.pb.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 -// source: resource_export_service.proto - -package v1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// 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 ( - Service_PageExport_FullMethodName = "/export.Service/PageExport" - Service_AddExport_FullMethodName = "/export.Service/AddExport" - Service_AddExportExcel_FullMethodName = "/export.Service/AddExportExcel" - Service_DeleteExport_FullMethodName = "/export.Service/DeleteExport" -) - -// ServiceClient is the client API for Service 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 ServiceClient interface { - PageExport(ctx context.Context, in *PageExportRequest, opts ...grpc.CallOption) (*PageExportReply, error) - AddExport(ctx context.Context, in *AddExportRequest, opts ...grpc.CallOption) (*AddExportReply, error) - AddExportExcel(ctx context.Context, in *AddExportExcelRequest, opts ...grpc.CallOption) (*AddExportExcelReply, error) - DeleteExport(ctx context.Context, in *DeleteExportRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) -} - -type serviceClient struct { - cc grpc.ClientConnInterface -} - -func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient { - return &serviceClient{cc} -} - -func (c *serviceClient) PageExport(ctx context.Context, in *PageExportRequest, opts ...grpc.CallOption) (*PageExportReply, error) { - out := new(PageExportReply) - err := c.cc.Invoke(ctx, Service_PageExport_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AddExport(ctx context.Context, in *AddExportRequest, opts ...grpc.CallOption) (*AddExportReply, error) { - out := new(AddExportReply) - err := c.cc.Invoke(ctx, Service_AddExport_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AddExportExcel(ctx context.Context, in *AddExportExcelRequest, opts ...grpc.CallOption) (*AddExportExcelReply, error) { - out := new(AddExportExcelReply) - err := c.cc.Invoke(ctx, Service_AddExportExcel_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteExport(ctx context.Context, in *DeleteExportRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Service_DeleteExport_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ServiceServer is the server API for Service service. -// All implementations must embed UnimplementedServiceServer -// for forward compatibility -type ServiceServer interface { - PageExport(context.Context, *PageExportRequest) (*PageExportReply, error) - AddExport(context.Context, *AddExportRequest) (*AddExportReply, error) - AddExportExcel(context.Context, *AddExportExcelRequest) (*AddExportExcelReply, error) - DeleteExport(context.Context, *DeleteExportRequest) (*emptypb.Empty, error) - mustEmbedUnimplementedServiceServer() -} - -// UnimplementedServiceServer must be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { -} - -func (UnimplementedServiceServer) PageExport(context.Context, *PageExportRequest) (*PageExportReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PageExport not implemented") -} -func (UnimplementedServiceServer) AddExport(context.Context, *AddExportRequest) (*AddExportReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddExport not implemented") -} -func (UnimplementedServiceServer) AddExportExcel(context.Context, *AddExportExcelRequest) (*AddExportExcelReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddExportExcel not implemented") -} -func (UnimplementedServiceServer) DeleteExport(context.Context, *DeleteExportRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteExport not implemented") -} -func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {} - -// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ServiceServer will -// result in compilation errors. -type UnsafeServiceServer interface { - mustEmbedUnimplementedServiceServer() -} - -func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer) { - s.RegisterService(&Service_ServiceDesc, srv) -} - -func _Service_PageExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PageExportRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).PageExport(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_PageExport_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).PageExport(ctx, req.(*PageExportRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_AddExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddExportRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).AddExport(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_AddExport_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).AddExport(ctx, req.(*AddExportRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_AddExportExcel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddExportExcelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).AddExportExcel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_AddExportExcel_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).AddExportExcel(ctx, req.(*AddExportExcelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_DeleteExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteExportRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).DeleteExport(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_DeleteExport_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).DeleteExport(ctx, req.(*DeleteExportRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Service_ServiceDesc is the grpc.ServiceDesc for Service service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Service_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "export.Service", - HandlerType: (*ServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "PageExport", - Handler: _Service_PageExport_Handler, - }, - { - MethodName: "AddExport", - Handler: _Service_AddExport_Handler, - }, - { - MethodName: "AddExportExcel", - Handler: _Service_AddExportExcel_Handler, - }, - { - MethodName: "DeleteExport", - Handler: _Service_DeleteExport_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "resource_export_service.proto", -} diff --git a/api/export/v1/resource_export_service_http.pb.go b/api/export/v1/resource_export_service_http.pb.go deleted file mode 100644 index 00d8248..0000000 --- a/api/export/v1/resource_export_service_http.pb.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by protoc-gen-go-http. DO NOT EDIT. -// versions: -// - protoc-gen-go-http v2.7.0 -// - protoc v4.24.4 -// source: resource_export_service.proto - -package v1 - -import ( - context "context" - http "github.com/go-kratos/kratos/v2/transport/http" - binding "github.com/go-kratos/kratos/v2/transport/http/binding" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the kratos package it is being compiled against. -var _ = new(context.Context) -var _ = binding.EncodeURL - -const _ = http.SupportPackageIsVersion1 - -const OperationServiceAddExport = "/export.Service/AddExport" -const OperationServiceAddExportExcel = "/export.Service/AddExportExcel" -const OperationServiceDeleteExport = "/export.Service/DeleteExport" -const OperationServicePageExport = "/export.Service/PageExport" - -type ServiceHTTPServer interface { - AddExport(context.Context, *AddExportRequest) (*AddExportReply, error) - AddExportExcel(context.Context, *AddExportExcelRequest) (*AddExportExcelReply, error) - DeleteExport(context.Context, *DeleteExportRequest) (*emptypb.Empty, error) - PageExport(context.Context, *PageExportRequest) (*PageExportReply, error) -} - -func RegisterServiceHTTPServer(s *http.Server, srv ServiceHTTPServer) { - r := s.Route("/") - r.GET("/resource/v1/exports", _Service_PageExport0_HTTP_Handler(srv)) - r.POST("/resource/v1/export", _Service_AddExport0_HTTP_Handler(srv)) - r.POST("/resource/v1/export/excel", _Service_AddExportExcel0_HTTP_Handler(srv)) - r.DELETE("/resource/v1/export", _Service_DeleteExport0_HTTP_Handler(srv)) -} - -func _Service_PageExport0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in PageExportRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServicePageExport) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.PageExport(ctx, req.(*PageExportRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*PageExportReply) - return ctx.Result(200, reply) - } -} - -func _Service_AddExport0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in AddExportRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceAddExport) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.AddExport(ctx, req.(*AddExportRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*AddExportReply) - return ctx.Result(200, reply) - } -} - -func _Service_AddExportExcel0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in AddExportExcelRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceAddExportExcel) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.AddExportExcel(ctx, req.(*AddExportExcelRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*AddExportExcelReply) - return ctx.Result(200, reply) - } -} - -func _Service_DeleteExport0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in DeleteExportRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceDeleteExport) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.DeleteExport(ctx, req.(*DeleteExportRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*emptypb.Empty) - return ctx.Result(200, reply) - } -} - -type ServiceHTTPClient interface { - AddExport(ctx context.Context, req *AddExportRequest, opts ...http.CallOption) (rsp *AddExportReply, err error) - AddExportExcel(ctx context.Context, req *AddExportExcelRequest, opts ...http.CallOption) (rsp *AddExportExcelReply, err error) - DeleteExport(ctx context.Context, req *DeleteExportRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error) - PageExport(ctx context.Context, req *PageExportRequest, opts ...http.CallOption) (rsp *PageExportReply, err error) -} - -type ServiceHTTPClientImpl struct { - cc *http.Client -} - -func NewServiceHTTPClient(client *http.Client) ServiceHTTPClient { - return &ServiceHTTPClientImpl{client} -} - -func (c *ServiceHTTPClientImpl) AddExport(ctx context.Context, in *AddExportRequest, opts ...http.CallOption) (*AddExportReply, error) { - var out AddExportReply - pattern := "/resource/v1/export" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationServiceAddExport)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) AddExportExcel(ctx context.Context, in *AddExportExcelRequest, opts ...http.CallOption) (*AddExportExcelReply, error) { - var out AddExportExcelReply - pattern := "/resource/v1/export/excel" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationServiceAddExportExcel)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) DeleteExport(ctx context.Context, in *DeleteExportRequest, opts ...http.CallOption) (*emptypb.Empty, error) { - var out emptypb.Empty - pattern := "/resource/v1/export" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationServiceDeleteExport)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) PageExport(ctx context.Context, in *PageExportRequest, opts ...http.CallOption) (*PageExportReply, error) { - var out PageExportReply - pattern := "/resource/v1/exports" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationServicePageExport)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} diff --git a/api/file/resource_directory.proto b/api/file/resource_directory.proto deleted file mode 100644 index 379b6ea..0000000 --- a/api/file/resource_directory.proto +++ /dev/null @@ -1,41 +0,0 @@ -syntax = "proto3"; - -package file; -option go_package = "./v1;v1"; -import "google/api/annotations.proto"; -import "validate/validate.proto"; - -message Directory{ - uint32 id = 1; - optional uint32 parent_id = 2; - string app = 3; - string name = 4; - uint32 created_at = 5; - uint32 updated_at = 6; -} - -message AllDirectoryRequest{ - uint32 parent_id = 1; - string app = 2[(validate.rules).string = {min_len:0}]; -} - -message AllDirectoryReply{ - repeated Directory list = 1; -} - -message AddDirectoryRequest{ - uint32 parent_id = 1; - string name = 2[(validate.rules).string = {min_len:1}]; - string app = 3[(validate.rules).string = {min_len:1}]; -} - -message UpdateDirectoryRequest{ - uint32 id = 1[(validate.rules).uint32 = {gt:0}]; - string app = 2[(validate.rules).string = {min_len:1}]; - string name = 3[(validate.rules).string = {min_len:1}]; -} - -message DeleteDirectoryRequest{ - uint32 id = 1[(validate.rules).uint32 = {gt:0}]; - string app = 2[(validate.rules).string = {min_len:1}]; -} \ No newline at end of file diff --git a/api/file/resource_file.proto b/api/file/resource_file.proto deleted file mode 100644 index 3e3618e..0000000 --- a/api/file/resource_file.proto +++ /dev/null @@ -1,96 +0,0 @@ -syntax = "proto3"; - -package file; -option go_package = "./v1;v1"; -import "google/api/annotations.proto"; -import "validate/validate.proto"; - -message File{ - uint32 id = 11; - uint32 directory_id = 1; - string name = 2; - string type = 3; - uint32 size = 4; - string sha = 5; - string src = 6; - string storage = 9; - uint32 created_at = 10; -} - -message GetFileRequest{ - string src =1[(validate.rules).string = {min_len:1}]; - uint32 width =2; - uint32 height =3; - string mode = 4; - bool is_range = 5; - uint32 start = 6; - uint32 end = 7; - bool download = 8; - string save_name = 9; -} - -message GetFileReply{ - bytes data = 1; - string mime = 2; -} - -message GetFileByShaRequest{ - string sha = 5[(validate.rules).string = {min_len:1}]; -} - -message PrepareUploadFileRequest{ - uint32 directory_id = 1; - string directory_path = 2; - string app = 3[(validate.rules).string = {min_len:1}]; - string name = 4[(validate.rules).string = {min_len:1}]; - string sha = 5[(validate.rules).string = {min_len:1}]; - uint32 size = 6[(validate.rules).uint32 = {gt:0}]; -} - -message PrepareUploadFileReply{ - optional bool uploaded = 1; - optional string src = 2; - optional uint32 chunk_size = 3; - optional uint32 chunk_count = 4; - optional string upload_id = 5; - repeated uint32 upload_chunks = 6; - optional string sha = 7; -} - -message PageFileRequest{ - uint32 directory_id = 1[(validate.rules).uint32 = {gt:0}]; - string app = 2[(validate.rules).string = {min_len:1}]; - optional string name = 3; - uint32 page = 4[(validate.rules).uint32 = {gt:0}]; - uint32 page_size = 5[(validate.rules).uint32 = {gt:0,lte:100}]; -} - -message PageFileReply{ - repeated File list = 1; - optional uint32 total = 2; -} - - -message UpdateFileRequest{ - uint32 id = 1[(validate.rules).uint32 = {gt:0}]; - string app = 2[(validate.rules).string = {min_len:1}]; - string name = 3[(validate.rules).string = {min_len:1}]; - uint32 directory_id = 4[(validate.rules).uint32 = {gt:0}]; -} - -message DeleteFileRequest{ - repeated uint32 ids = 1[(validate.rules).repeated = {min_items:1}]; - string app = 2[(validate.rules).string = {min_len:1}]; - uint32 directory_id = 3[(validate.rules).uint32 = {gt:0}]; -} - -message UploadFileRequest{ - bytes data = 1[(validate.rules).bytes = {min_len:0}]; - string upload_id = 2[(validate.rules).string = {min_len:1}]; - uint32 index = 3[(validate.rules).uint32 = {gt:0}];; -} - -message UploadFileReply{ - string src = 1; - string sha = 2; -} diff --git a/api/file/resource_file_service.proto b/api/file/resource_file_service.proto deleted file mode 100644 index ae6c26f..0000000 --- a/api/file/resource_file_service.proto +++ /dev/null @@ -1,81 +0,0 @@ -syntax = "proto3"; - -package file; -option go_package = "./v1;v1"; - -import "google/api/annotations.proto"; -import "resource_file.proto"; -import "resource_directory.proto"; -import "google/protobuf/empty.proto"; - -service Service { - rpc AllDirectory (AllDirectoryRequest) returns (AllDirectoryReply) { - option (google.api.http) = { - get: "/resource/v1/directories", - }; - } - - rpc AddDirectory (AddDirectoryRequest) returns (Directory) { - option (google.api.http) = { - post: "/resource/v1/directory", - body:"*", - }; - } - - rpc UpdateDirectory (UpdateDirectoryRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - put: "/resource/v1/directory", - body:"*", - }; - } - - rpc DeleteDirectory (DeleteDirectoryRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/resource/v1/directory", - }; - } - - rpc PrepareUploadFile (PrepareUploadFileRequest) returns (PrepareUploadFileReply) { - option (google.api.http) = { - post: "/resource/v1/upload/prepare", - body:"*", - additional_bindings:{ - post: "/resource/client/v1/upload/prepare", - body:"*", - } - }; - } - - rpc UploadFile(UploadFileRequest) returns (UploadFileReply){} - - rpc PageFile (PageFileRequest) returns (PageFileReply) { - option (google.api.http) = { - get: "/resource/v1/files" - }; - } - - rpc GetFileBySha (GetFileByShaRequest) returns (File) { - option (google.api.http) = { - get: "/resource/v1/file/sha", - additional_bindings:{ - get: "/resource/client/v1/file/sha", - } - }; - } - - rpc UpdateFile (UpdateFileRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - put: "/resource/v1/file", - body:"*" - }; - } - - rpc DeleteFile (DeleteFileRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/resource/v1/file", - body:"*" - }; - } -} - - diff --git a/api/file/v1/resource_directory.pb.go b/api/file/v1/resource_directory.pb.go deleted file mode 100644 index cb58806..0000000 --- a/api/file/v1/resource_directory.pb.go +++ /dev/null @@ -1,573 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 -// source: resource_directory.proto - -package v1 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - _ "google.golang.org/genproto/googleapis/api/annotations" - 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) -) - -type Directory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - ParentId *uint32 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3,oneof" json:"parent_id,omitempty"` - App string `protobuf:"bytes,3,opt,name=app,proto3" json:"app,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - CreatedAt uint32 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - UpdatedAt uint32 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` -} - -func (x *Directory) Reset() { - *x = Directory{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_directory_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Directory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Directory) ProtoMessage() {} - -func (x *Directory) ProtoReflect() protoreflect.Message { - mi := &file_resource_directory_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 Directory.ProtoReflect.Descriptor instead. -func (*Directory) Descriptor() ([]byte, []int) { - return file_resource_directory_proto_rawDescGZIP(), []int{0} -} - -func (x *Directory) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Directory) GetParentId() uint32 { - if x != nil && x.ParentId != nil { - return *x.ParentId - } - return 0 -} - -func (x *Directory) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -func (x *Directory) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Directory) GetCreatedAt() uint32 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *Directory) GetUpdatedAt() uint32 { - if x != nil { - return x.UpdatedAt - } - return 0 -} - -type AllDirectoryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ParentId uint32 `protobuf:"varint,1,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` - App string `protobuf:"bytes,2,opt,name=app,proto3" json:"app,omitempty"` -} - -func (x *AllDirectoryRequest) Reset() { - *x = AllDirectoryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_directory_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AllDirectoryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AllDirectoryRequest) ProtoMessage() {} - -func (x *AllDirectoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_directory_proto_msgTypes[1] - 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 AllDirectoryRequest.ProtoReflect.Descriptor instead. -func (*AllDirectoryRequest) Descriptor() ([]byte, []int) { - return file_resource_directory_proto_rawDescGZIP(), []int{1} -} - -func (x *AllDirectoryRequest) GetParentId() uint32 { - if x != nil { - return x.ParentId - } - return 0 -} - -func (x *AllDirectoryRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -type AllDirectoryReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - List []*Directory `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` -} - -func (x *AllDirectoryReply) Reset() { - *x = AllDirectoryReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_directory_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AllDirectoryReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AllDirectoryReply) ProtoMessage() {} - -func (x *AllDirectoryReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_directory_proto_msgTypes[2] - 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 AllDirectoryReply.ProtoReflect.Descriptor instead. -func (*AllDirectoryReply) Descriptor() ([]byte, []int) { - return file_resource_directory_proto_rawDescGZIP(), []int{2} -} - -func (x *AllDirectoryReply) GetList() []*Directory { - if x != nil { - return x.List - } - return nil -} - -type AddDirectoryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ParentId uint32 `protobuf:"varint,1,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - App string `protobuf:"bytes,3,opt,name=app,proto3" json:"app,omitempty"` -} - -func (x *AddDirectoryRequest) Reset() { - *x = AddDirectoryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_directory_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddDirectoryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddDirectoryRequest) ProtoMessage() {} - -func (x *AddDirectoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_directory_proto_msgTypes[3] - 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 AddDirectoryRequest.ProtoReflect.Descriptor instead. -func (*AddDirectoryRequest) Descriptor() ([]byte, []int) { - return file_resource_directory_proto_rawDescGZIP(), []int{3} -} - -func (x *AddDirectoryRequest) GetParentId() uint32 { - if x != nil { - return x.ParentId - } - return 0 -} - -func (x *AddDirectoryRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AddDirectoryRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -type UpdateDirectoryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - App string `protobuf:"bytes,2,opt,name=app,proto3" json:"app,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *UpdateDirectoryRequest) Reset() { - *x = UpdateDirectoryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_directory_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateDirectoryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateDirectoryRequest) ProtoMessage() {} - -func (x *UpdateDirectoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_directory_proto_msgTypes[4] - 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 UpdateDirectoryRequest.ProtoReflect.Descriptor instead. -func (*UpdateDirectoryRequest) Descriptor() ([]byte, []int) { - return file_resource_directory_proto_rawDescGZIP(), []int{4} -} - -func (x *UpdateDirectoryRequest) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *UpdateDirectoryRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -func (x *UpdateDirectoryRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type DeleteDirectoryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - App string `protobuf:"bytes,2,opt,name=app,proto3" json:"app,omitempty"` -} - -func (x *DeleteDirectoryRequest) Reset() { - *x = DeleteDirectoryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_directory_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteDirectoryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteDirectoryRequest) ProtoMessage() {} - -func (x *DeleteDirectoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_directory_proto_msgTypes[5] - 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 DeleteDirectoryRequest.ProtoReflect.Descriptor instead. -func (*DeleteDirectoryRequest) Descriptor() ([]byte, []int) { - return file_resource_directory_proto_rawDescGZIP(), []int{5} -} - -func (x *DeleteDirectoryRequest) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *DeleteDirectoryRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -var File_resource_directory_proto protoreflect.FileDescriptor - -var file_resource_directory_proto_rawDesc = []byte{ - 0x0a, 0x18, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x66, 0x69, 0x6c, 0x65, - 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x01, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, - 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x4d, 0x0a, 0x13, 0x41, 0x6c, 0x6c, - 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, - 0x03, 0x61, 0x70, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x00, 0x52, 0x03, 0x61, 0x70, 0x70, 0x22, 0x38, 0x0a, 0x11, 0x41, 0x6c, 0x6c, 0x44, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x23, 0x0a, - 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x66, 0x69, - 0x6c, 0x65, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x04, 0x6c, 0x69, - 0x73, 0x74, 0x22, 0x6a, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x61, 0x70, 0x70, 0x22, 0x69, - 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x19, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, 0x1b, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4c, 0x0a, 0x16, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x03, - 0x61, 0x70, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x03, 0x61, 0x70, 0x70, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x76, 0x31, 0x3b, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_resource_directory_proto_rawDescOnce sync.Once - file_resource_directory_proto_rawDescData = file_resource_directory_proto_rawDesc -) - -func file_resource_directory_proto_rawDescGZIP() []byte { - file_resource_directory_proto_rawDescOnce.Do(func() { - file_resource_directory_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_directory_proto_rawDescData) - }) - return file_resource_directory_proto_rawDescData -} - -var file_resource_directory_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_resource_directory_proto_goTypes = []interface{}{ - (*Directory)(nil), // 0: file.Directory - (*AllDirectoryRequest)(nil), // 1: file.AllDirectoryRequest - (*AllDirectoryReply)(nil), // 2: file.AllDirectoryReply - (*AddDirectoryRequest)(nil), // 3: file.AddDirectoryRequest - (*UpdateDirectoryRequest)(nil), // 4: file.UpdateDirectoryRequest - (*DeleteDirectoryRequest)(nil), // 5: file.DeleteDirectoryRequest -} -var file_resource_directory_proto_depIdxs = []int32{ - 0, // 0: file.AllDirectoryReply.list:type_name -> file.Directory - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_resource_directory_proto_init() } -func file_resource_directory_proto_init() { - if File_resource_directory_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_resource_directory_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Directory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_directory_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllDirectoryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_directory_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllDirectoryReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_directory_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddDirectoryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_directory_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateDirectoryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_directory_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteDirectoryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_resource_directory_proto_msgTypes[0].OneofWrappers = []interface{}{} - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_resource_directory_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_resource_directory_proto_goTypes, - DependencyIndexes: file_resource_directory_proto_depIdxs, - MessageInfos: file_resource_directory_proto_msgTypes, - }.Build() - File_resource_directory_proto = out.File - file_resource_directory_proto_rawDesc = nil - file_resource_directory_proto_goTypes = nil - file_resource_directory_proto_depIdxs = nil -} diff --git a/api/file/v1/resource_directory.pb.validate.go b/api/file/v1/resource_directory.pb.validate.go deleted file mode 100644 index a3572b6..0000000 --- a/api/file/v1/resource_directory.pb.validate.go +++ /dev/null @@ -1,785 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: resource_directory.proto - -package v1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on Directory with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Directory) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Directory with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DirectoryMultiError, or nil -// if none found. -func (m *Directory) ValidateAll() error { - return m.validate(true) -} - -func (m *Directory) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for App - - // no validation rules for Name - - // no validation rules for CreatedAt - - // no validation rules for UpdatedAt - - if m.ParentId != nil { - // no validation rules for ParentId - } - - if len(errors) > 0 { - return DirectoryMultiError(errors) - } - - return nil -} - -// DirectoryMultiError is an error wrapping multiple validation errors returned -// by Directory.ValidateAll() if the designated constraints aren't met. -type DirectoryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DirectoryMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DirectoryMultiError) AllErrors() []error { return m } - -// DirectoryValidationError is the validation error returned by -// Directory.Validate if the designated constraints aren't met. -type DirectoryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DirectoryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DirectoryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DirectoryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DirectoryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DirectoryValidationError) ErrorName() string { return "DirectoryValidationError" } - -// Error satisfies the builtin error interface -func (e DirectoryValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDirectory.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DirectoryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DirectoryValidationError{} - -// Validate checks the field values on AllDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AllDirectoryRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AllDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AllDirectoryRequestMultiError, or nil if none found. -func (m *AllDirectoryRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AllDirectoryRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ParentId - - if utf8.RuneCountInString(m.GetApp()) < 0 { - err := AllDirectoryRequestValidationError{ - field: "App", - reason: "value length must be at least 0 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AllDirectoryRequestMultiError(errors) - } - - return nil -} - -// AllDirectoryRequestMultiError is an error wrapping multiple validation -// errors returned by AllDirectoryRequest.ValidateAll() if the designated -// constraints aren't met. -type AllDirectoryRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AllDirectoryRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AllDirectoryRequestMultiError) AllErrors() []error { return m } - -// AllDirectoryRequestValidationError is the validation error returned by -// AllDirectoryRequest.Validate if the designated constraints aren't met. -type AllDirectoryRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AllDirectoryRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AllDirectoryRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AllDirectoryRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AllDirectoryRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AllDirectoryRequestValidationError) ErrorName() string { - return "AllDirectoryRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e AllDirectoryRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAllDirectoryRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AllDirectoryRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AllDirectoryRequestValidationError{} - -// Validate checks the field values on AllDirectoryReply with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *AllDirectoryReply) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AllDirectoryReply with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AllDirectoryReplyMultiError, or nil if none found. -func (m *AllDirectoryReply) ValidateAll() error { - return m.validate(true) -} - -func (m *AllDirectoryReply) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetList() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AllDirectoryReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AllDirectoryReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AllDirectoryReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return AllDirectoryReplyMultiError(errors) - } - - return nil -} - -// AllDirectoryReplyMultiError is an error wrapping multiple validation errors -// returned by AllDirectoryReply.ValidateAll() if the designated constraints -// aren't met. -type AllDirectoryReplyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AllDirectoryReplyMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AllDirectoryReplyMultiError) AllErrors() []error { return m } - -// AllDirectoryReplyValidationError is the validation error returned by -// AllDirectoryReply.Validate if the designated constraints aren't met. -type AllDirectoryReplyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AllDirectoryReplyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AllDirectoryReplyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AllDirectoryReplyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AllDirectoryReplyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AllDirectoryReplyValidationError) ErrorName() string { - return "AllDirectoryReplyValidationError" -} - -// Error satisfies the builtin error interface -func (e AllDirectoryReplyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAllDirectoryReply.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AllDirectoryReplyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AllDirectoryReplyValidationError{} - -// Validate checks the field values on AddDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *AddDirectoryRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// AddDirectoryRequestMultiError, or nil if none found. -func (m *AddDirectoryRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AddDirectoryRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ParentId - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := AddDirectoryRequestValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetApp()) < 1 { - err := AddDirectoryRequestValidationError{ - field: "App", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AddDirectoryRequestMultiError(errors) - } - - return nil -} - -// AddDirectoryRequestMultiError is an error wrapping multiple validation -// errors returned by AddDirectoryRequest.ValidateAll() if the designated -// constraints aren't met. -type AddDirectoryRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddDirectoryRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AddDirectoryRequestMultiError) AllErrors() []error { return m } - -// AddDirectoryRequestValidationError is the validation error returned by -// AddDirectoryRequest.Validate if the designated constraints aren't met. -type AddDirectoryRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddDirectoryRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddDirectoryRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddDirectoryRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddDirectoryRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddDirectoryRequestValidationError) ErrorName() string { - return "AddDirectoryRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e AddDirectoryRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAddDirectoryRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddDirectoryRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddDirectoryRequestValidationError{} - -// Validate checks the field values on UpdateDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateDirectoryRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpdateDirectoryRequestMultiError, or nil if none found. -func (m *UpdateDirectoryRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateDirectoryRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetId() <= 0 { - err := UpdateDirectoryRequestValidationError{ - field: "Id", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetApp()) < 1 { - err := UpdateDirectoryRequestValidationError{ - field: "App", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := UpdateDirectoryRequestValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return UpdateDirectoryRequestMultiError(errors) - } - - return nil -} - -// UpdateDirectoryRequestMultiError is an error wrapping multiple validation -// errors returned by UpdateDirectoryRequest.ValidateAll() if the designated -// constraints aren't met. -type UpdateDirectoryRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateDirectoryRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateDirectoryRequestMultiError) AllErrors() []error { return m } - -// UpdateDirectoryRequestValidationError is the validation error returned by -// UpdateDirectoryRequest.Validate if the designated constraints aren't met. -type UpdateDirectoryRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateDirectoryRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateDirectoryRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateDirectoryRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateDirectoryRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateDirectoryRequestValidationError) ErrorName() string { - return "UpdateDirectoryRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateDirectoryRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateDirectoryRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateDirectoryRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateDirectoryRequestValidationError{} - -// Validate checks the field values on DeleteDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteDirectoryRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteDirectoryRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteDirectoryRequestMultiError, or nil if none found. -func (m *DeleteDirectoryRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteDirectoryRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetId() <= 0 { - err := DeleteDirectoryRequestValidationError{ - field: "Id", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetApp()) < 1 { - err := DeleteDirectoryRequestValidationError{ - field: "App", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return DeleteDirectoryRequestMultiError(errors) - } - - return nil -} - -// DeleteDirectoryRequestMultiError is an error wrapping multiple validation -// errors returned by DeleteDirectoryRequest.ValidateAll() if the designated -// constraints aren't met. -type DeleteDirectoryRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteDirectoryRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteDirectoryRequestMultiError) AllErrors() []error { return m } - -// DeleteDirectoryRequestValidationError is the validation error returned by -// DeleteDirectoryRequest.Validate if the designated constraints aren't met. -type DeleteDirectoryRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteDirectoryRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteDirectoryRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteDirectoryRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteDirectoryRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteDirectoryRequestValidationError) ErrorName() string { - return "DeleteDirectoryRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteDirectoryRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteDirectoryRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteDirectoryRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteDirectoryRequestValidationError{} diff --git a/api/file/v1/resource_file.pb.go b/api/file/v1/resource_file.pb.go deleted file mode 100644 index d9c042d..0000000 --- a/api/file/v1/resource_file.pb.go +++ /dev/null @@ -1,1250 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 -// source: resource_file.proto - -package v1 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - _ "google.golang.org/genproto/googleapis/api/annotations" - 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) -) - -type File struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,11,opt,name=id,proto3" json:"id,omitempty"` - DirectoryId uint32 `protobuf:"varint,1,opt,name=directory_id,json=directoryId,proto3" json:"directory_id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` - Size uint32 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` - Sha string `protobuf:"bytes,5,opt,name=sha,proto3" json:"sha,omitempty"` - Src string `protobuf:"bytes,6,opt,name=src,proto3" json:"src,omitempty"` - Storage string `protobuf:"bytes,9,opt,name=storage,proto3" json:"storage,omitempty"` - CreatedAt uint32 `protobuf:"varint,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` -} - -func (x *File) Reset() { - *x = File{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *File) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*File) ProtoMessage() {} - -func (x *File) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_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 File.ProtoReflect.Descriptor instead. -func (*File) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{0} -} - -func (x *File) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *File) GetDirectoryId() uint32 { - if x != nil { - return x.DirectoryId - } - return 0 -} - -func (x *File) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *File) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *File) GetSize() uint32 { - if x != nil { - return x.Size - } - return 0 -} - -func (x *File) GetSha() string { - if x != nil { - return x.Sha - } - return "" -} - -func (x *File) GetSrc() string { - if x != nil { - return x.Src - } - return "" -} - -func (x *File) GetStorage() string { - if x != nil { - return x.Storage - } - return "" -} - -func (x *File) GetCreatedAt() uint32 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -type GetFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` - Width uint32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` - Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` - Mode string `protobuf:"bytes,4,opt,name=mode,proto3" json:"mode,omitempty"` - IsRange bool `protobuf:"varint,5,opt,name=is_range,json=isRange,proto3" json:"is_range,omitempty"` - Start uint32 `protobuf:"varint,6,opt,name=start,proto3" json:"start,omitempty"` - End uint32 `protobuf:"varint,7,opt,name=end,proto3" json:"end,omitempty"` - Download bool `protobuf:"varint,8,opt,name=download,proto3" json:"download,omitempty"` - SaveName string `protobuf:"bytes,9,opt,name=save_name,json=saveName,proto3" json:"save_name,omitempty"` -} - -func (x *GetFileRequest) Reset() { - *x = GetFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFileRequest) ProtoMessage() {} - -func (x *GetFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[1] - 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 GetFileRequest.ProtoReflect.Descriptor instead. -func (*GetFileRequest) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{1} -} - -func (x *GetFileRequest) GetSrc() string { - if x != nil { - return x.Src - } - return "" -} - -func (x *GetFileRequest) GetWidth() uint32 { - if x != nil { - return x.Width - } - return 0 -} - -func (x *GetFileRequest) GetHeight() uint32 { - if x != nil { - return x.Height - } - return 0 -} - -func (x *GetFileRequest) GetMode() string { - if x != nil { - return x.Mode - } - return "" -} - -func (x *GetFileRequest) GetIsRange() bool { - if x != nil { - return x.IsRange - } - return false -} - -func (x *GetFileRequest) GetStart() uint32 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *GetFileRequest) GetEnd() uint32 { - if x != nil { - return x.End - } - return 0 -} - -func (x *GetFileRequest) GetDownload() bool { - if x != nil { - return x.Download - } - return false -} - -func (x *GetFileRequest) GetSaveName() string { - if x != nil { - return x.SaveName - } - return "" -} - -type GetFileReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - Mime string `protobuf:"bytes,2,opt,name=mime,proto3" json:"mime,omitempty"` -} - -func (x *GetFileReply) Reset() { - *x = GetFileReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFileReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFileReply) ProtoMessage() {} - -func (x *GetFileReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[2] - 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 GetFileReply.ProtoReflect.Descriptor instead. -func (*GetFileReply) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{2} -} - -func (x *GetFileReply) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *GetFileReply) GetMime() string { - if x != nil { - return x.Mime - } - return "" -} - -type GetFileByShaRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sha string `protobuf:"bytes,5,opt,name=sha,proto3" json:"sha,omitempty"` -} - -func (x *GetFileByShaRequest) Reset() { - *x = GetFileByShaRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFileByShaRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFileByShaRequest) ProtoMessage() {} - -func (x *GetFileByShaRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[3] - 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 GetFileByShaRequest.ProtoReflect.Descriptor instead. -func (*GetFileByShaRequest) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{3} -} - -func (x *GetFileByShaRequest) GetSha() string { - if x != nil { - return x.Sha - } - return "" -} - -type PrepareUploadFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DirectoryId uint32 `protobuf:"varint,1,opt,name=directory_id,json=directoryId,proto3" json:"directory_id,omitempty"` - DirectoryPath string `protobuf:"bytes,2,opt,name=directory_path,json=directoryPath,proto3" json:"directory_path,omitempty"` - App string `protobuf:"bytes,3,opt,name=app,proto3" json:"app,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Sha string `protobuf:"bytes,5,opt,name=sha,proto3" json:"sha,omitempty"` - Size uint32 `protobuf:"varint,6,opt,name=size,proto3" json:"size,omitempty"` -} - -func (x *PrepareUploadFileRequest) Reset() { - *x = PrepareUploadFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrepareUploadFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrepareUploadFileRequest) ProtoMessage() {} - -func (x *PrepareUploadFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[4] - 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 PrepareUploadFileRequest.ProtoReflect.Descriptor instead. -func (*PrepareUploadFileRequest) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{4} -} - -func (x *PrepareUploadFileRequest) GetDirectoryId() uint32 { - if x != nil { - return x.DirectoryId - } - return 0 -} - -func (x *PrepareUploadFileRequest) GetDirectoryPath() string { - if x != nil { - return x.DirectoryPath - } - return "" -} - -func (x *PrepareUploadFileRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -func (x *PrepareUploadFileRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PrepareUploadFileRequest) GetSha() string { - if x != nil { - return x.Sha - } - return "" -} - -func (x *PrepareUploadFileRequest) GetSize() uint32 { - if x != nil { - return x.Size - } - return 0 -} - -type PrepareUploadFileReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uploaded *bool `protobuf:"varint,1,opt,name=uploaded,proto3,oneof" json:"uploaded,omitempty"` - Src *string `protobuf:"bytes,2,opt,name=src,proto3,oneof" json:"src,omitempty"` - ChunkSize *uint32 `protobuf:"varint,3,opt,name=chunk_size,json=chunkSize,proto3,oneof" json:"chunk_size,omitempty"` - ChunkCount *uint32 `protobuf:"varint,4,opt,name=chunk_count,json=chunkCount,proto3,oneof" json:"chunk_count,omitempty"` - UploadId *string `protobuf:"bytes,5,opt,name=upload_id,json=uploadId,proto3,oneof" json:"upload_id,omitempty"` - UploadChunks []uint32 `protobuf:"varint,6,rep,packed,name=upload_chunks,json=uploadChunks,proto3" json:"upload_chunks,omitempty"` - Sha *string `protobuf:"bytes,7,opt,name=sha,proto3,oneof" json:"sha,omitempty"` -} - -func (x *PrepareUploadFileReply) Reset() { - *x = PrepareUploadFileReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrepareUploadFileReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrepareUploadFileReply) ProtoMessage() {} - -func (x *PrepareUploadFileReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[5] - 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 PrepareUploadFileReply.ProtoReflect.Descriptor instead. -func (*PrepareUploadFileReply) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{5} -} - -func (x *PrepareUploadFileReply) GetUploaded() bool { - if x != nil && x.Uploaded != nil { - return *x.Uploaded - } - return false -} - -func (x *PrepareUploadFileReply) GetSrc() string { - if x != nil && x.Src != nil { - return *x.Src - } - return "" -} - -func (x *PrepareUploadFileReply) GetChunkSize() uint32 { - if x != nil && x.ChunkSize != nil { - return *x.ChunkSize - } - return 0 -} - -func (x *PrepareUploadFileReply) GetChunkCount() uint32 { - if x != nil && x.ChunkCount != nil { - return *x.ChunkCount - } - return 0 -} - -func (x *PrepareUploadFileReply) GetUploadId() string { - if x != nil && x.UploadId != nil { - return *x.UploadId - } - return "" -} - -func (x *PrepareUploadFileReply) GetUploadChunks() []uint32 { - if x != nil { - return x.UploadChunks - } - return nil -} - -func (x *PrepareUploadFileReply) GetSha() string { - if x != nil && x.Sha != nil { - return *x.Sha - } - return "" -} - -type PageFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DirectoryId uint32 `protobuf:"varint,1,opt,name=directory_id,json=directoryId,proto3" json:"directory_id,omitempty"` - App string `protobuf:"bytes,2,opt,name=app,proto3" json:"app,omitempty"` - Name *string `protobuf:"bytes,3,opt,name=name,proto3,oneof" json:"name,omitempty"` - Page uint32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"` - PageSize uint32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` -} - -func (x *PageFileRequest) Reset() { - *x = PageFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PageFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PageFileRequest) ProtoMessage() {} - -func (x *PageFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[6] - 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 PageFileRequest.ProtoReflect.Descriptor instead. -func (*PageFileRequest) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{6} -} - -func (x *PageFileRequest) GetDirectoryId() uint32 { - if x != nil { - return x.DirectoryId - } - return 0 -} - -func (x *PageFileRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -func (x *PageFileRequest) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *PageFileRequest) GetPage() uint32 { - if x != nil { - return x.Page - } - return 0 -} - -func (x *PageFileRequest) GetPageSize() uint32 { - if x != nil { - return x.PageSize - } - return 0 -} - -type PageFileReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - List []*File `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` - Total *uint32 `protobuf:"varint,2,opt,name=total,proto3,oneof" json:"total,omitempty"` -} - -func (x *PageFileReply) Reset() { - *x = PageFileReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PageFileReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PageFileReply) ProtoMessage() {} - -func (x *PageFileReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[7] - 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 PageFileReply.ProtoReflect.Descriptor instead. -func (*PageFileReply) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{7} -} - -func (x *PageFileReply) GetList() []*File { - if x != nil { - return x.List - } - return nil -} - -func (x *PageFileReply) GetTotal() uint32 { - if x != nil && x.Total != nil { - return *x.Total - } - return 0 -} - -type UpdateFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - App string `protobuf:"bytes,2,opt,name=app,proto3" json:"app,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - DirectoryId uint32 `protobuf:"varint,4,opt,name=directory_id,json=directoryId,proto3" json:"directory_id,omitempty"` -} - -func (x *UpdateFileRequest) Reset() { - *x = UpdateFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateFileRequest) ProtoMessage() {} - -func (x *UpdateFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[8] - 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 UpdateFileRequest.ProtoReflect.Descriptor instead. -func (*UpdateFileRequest) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{8} -} - -func (x *UpdateFileRequest) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *UpdateFileRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -func (x *UpdateFileRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpdateFileRequest) GetDirectoryId() uint32 { - if x != nil { - return x.DirectoryId - } - return 0 -} - -type DeleteFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ids []uint32 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"` - App string `protobuf:"bytes,2,opt,name=app,proto3" json:"app,omitempty"` - DirectoryId uint32 `protobuf:"varint,3,opt,name=directory_id,json=directoryId,proto3" json:"directory_id,omitempty"` -} - -func (x *DeleteFileRequest) Reset() { - *x = DeleteFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteFileRequest) ProtoMessage() {} - -func (x *DeleteFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[9] - 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 DeleteFileRequest.ProtoReflect.Descriptor instead. -func (*DeleteFileRequest) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{9} -} - -func (x *DeleteFileRequest) GetIds() []uint32 { - if x != nil { - return x.Ids - } - return nil -} - -func (x *DeleteFileRequest) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -func (x *DeleteFileRequest) GetDirectoryId() uint32 { - if x != nil { - return x.DirectoryId - } - return 0 -} - -type UploadFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - UploadId string `protobuf:"bytes,2,opt,name=upload_id,json=uploadId,proto3" json:"upload_id,omitempty"` - Index uint32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` -} - -func (x *UploadFileRequest) Reset() { - *x = UploadFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UploadFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UploadFileRequest) ProtoMessage() {} - -func (x *UploadFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[10] - 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 UploadFileRequest.ProtoReflect.Descriptor instead. -func (*UploadFileRequest) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{10} -} - -func (x *UploadFileRequest) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *UploadFileRequest) GetUploadId() string { - if x != nil { - return x.UploadId - } - return "" -} - -func (x *UploadFileRequest) GetIndex() uint32 { - if x != nil { - return x.Index - } - return 0 -} - -type UploadFileReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` - Sha string `protobuf:"bytes,2,opt,name=sha,proto3" json:"sha,omitempty"` -} - -func (x *UploadFileReply) Reset() { - *x = UploadFileReply{} - if protoimpl.UnsafeEnabled { - mi := &file_resource_file_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UploadFileReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UploadFileReply) ProtoMessage() {} - -func (x *UploadFileReply) ProtoReflect() protoreflect.Message { - mi := &file_resource_file_proto_msgTypes[11] - 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 UploadFileReply.ProtoReflect.Descriptor instead. -func (*UploadFileReply) Descriptor() ([]byte, []int) { - return file_resource_file_proto_rawDescGZIP(), []int{11} -} - -func (x *UploadFileReply) GetSrc() string { - if x != nil { - return x.Src - } - return "" -} - -func (x *UploadFileReply) GetSha() string { - if x != nil { - return x.Sha - } - return "" -} - -var File_resource_file_proto protoreflect.FileDescriptor - -var file_resource_file_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xd2, 0x01, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x64, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, - 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x10, 0x0a, 0x03, - 0x73, 0x72, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x72, 0x63, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xe9, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x72, - 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, - 0x52, 0x03, 0x73, 0x72, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x72, 0x61, - 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, - 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x6f, - 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x61, 0x76, 0x65, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x61, 0x76, 0x65, 0x4e, - 0x61, 0x6d, 0x65, 0x22, 0x36, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x69, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x13, 0x47, - 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x79, 0x53, 0x68, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x73, 0x68, 0x61, 0x22, 0xd4, 0x01, - 0x0a, 0x18, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x25, 0x0a, - 0x0e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, - 0x50, 0x61, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, - 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, - 0x73, 0x68, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x1b, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x04, - 0x73, 0x69, 0x7a, 0x65, 0x22, 0xc2, 0x02, 0x0a, 0x16, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x1f, 0x0a, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x48, 0x00, 0x52, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x88, 0x01, 0x01, - 0x12, 0x15, 0x0a, 0x03, 0x73, 0x72, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, - 0x03, 0x73, 0x72, 0x63, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x09, 0x63, - 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x69, 0x7a, 0x65, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x63, - 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x03, 0x52, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x20, 0x0a, 0x09, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, - 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x63, 0x68, - 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x12, 0x15, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x05, 0x52, 0x03, 0x73, 0x68, 0x61, 0x88, 0x01, 0x01, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x42, 0x06, 0x0a, 0x04, - 0x5f, 0x73, 0x72, 0x63, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x73, - 0x69, 0x7a, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x69, - 0x64, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x73, 0x68, 0x61, 0x22, 0xbf, 0x01, 0x0a, 0x0f, 0x50, 0x61, - 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, - 0x0c, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x0b, 0x64, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x03, 0x61, 0x70, 0x70, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, - 0x03, 0x61, 0x70, 0x70, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x2a, 0x02, 0x20, 0x00, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x26, 0x0a, 0x09, 0x70, 0x61, - 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x09, 0xfa, - 0x42, 0x06, 0x2a, 0x04, 0x18, 0x64, 0x20, 0x00, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, - 0x7a, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x54, 0x0a, 0x0d, 0x50, - 0x61, 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x04, - 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x66, 0x69, 0x6c, - 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x05, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x74, - 0x6f, 0x74, 0x61, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x74, 0x6f, 0x74, 0x61, - 0x6c, 0x22, 0x90, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x19, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x0c, 0x64, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x49, 0x64, 0x22, 0x76, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x69, 0x64, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, - 0x52, 0x03, 0x69, 0x64, 0x73, 0x12, 0x19, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x61, 0x70, 0x70, - 0x12, 0x2a, 0x0a, 0x0c, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, - 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x22, 0x75, 0x0a, 0x11, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x7a, 0x02, 0x10, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x24, - 0x0a, 0x09, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x08, 0x75, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x05, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x22, 0x35, 0x0a, 0x0f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, - 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x72, 0x63, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x72, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, - 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_resource_file_proto_rawDescOnce sync.Once - file_resource_file_proto_rawDescData = file_resource_file_proto_rawDesc -) - -func file_resource_file_proto_rawDescGZIP() []byte { - file_resource_file_proto_rawDescOnce.Do(func() { - file_resource_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_resource_file_proto_rawDescData) - }) - return file_resource_file_proto_rawDescData -} - -var file_resource_file_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_resource_file_proto_goTypes = []interface{}{ - (*File)(nil), // 0: file.File - (*GetFileRequest)(nil), // 1: file.GetFileRequest - (*GetFileReply)(nil), // 2: file.GetFileReply - (*GetFileByShaRequest)(nil), // 3: file.GetFileByShaRequest - (*PrepareUploadFileRequest)(nil), // 4: file.PrepareUploadFileRequest - (*PrepareUploadFileReply)(nil), // 5: file.PrepareUploadFileReply - (*PageFileRequest)(nil), // 6: file.PageFileRequest - (*PageFileReply)(nil), // 7: file.PageFileReply - (*UpdateFileRequest)(nil), // 8: file.UpdateFileRequest - (*DeleteFileRequest)(nil), // 9: file.DeleteFileRequest - (*UploadFileRequest)(nil), // 10: file.UploadFileRequest - (*UploadFileReply)(nil), // 11: file.UploadFileReply -} -var file_resource_file_proto_depIdxs = []int32{ - 0, // 0: file.PageFileReply.list:type_name -> file.File - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_resource_file_proto_init() } -func file_resource_file_proto_init() { - if File_resource_file_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_resource_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*File); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFileReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFileByShaRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrepareUploadFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrepareUploadFileReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PageFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PageFileReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UploadFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_resource_file_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UploadFileReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_resource_file_proto_msgTypes[5].OneofWrappers = []interface{}{} - file_resource_file_proto_msgTypes[6].OneofWrappers = []interface{}{} - file_resource_file_proto_msgTypes[7].OneofWrappers = []interface{}{} - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_resource_file_proto_rawDesc, - NumEnums: 0, - NumMessages: 12, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_resource_file_proto_goTypes, - DependencyIndexes: file_resource_file_proto_depIdxs, - MessageInfos: file_resource_file_proto_msgTypes, - }.Build() - File_resource_file_proto = out.File - file_resource_file_proto_rawDesc = nil - file_resource_file_proto_goTypes = nil - file_resource_file_proto_depIdxs = nil -} diff --git a/api/file/v1/resource_file_service.pb.go b/api/file/v1/resource_file_service.pb.go deleted file mode 100644 index a759056..0000000 --- a/api/file/v1/resource_file_service.pb.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 -// source: resource_file_service.proto - -package v1 - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" -) - -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) -) - -var File_resource_file_service_proto protoreflect.FileDescriptor - -var file_resource_file_service_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x66, - 0x69, 0x6c, 0x65, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x13, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x8c, 0x08, - 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x64, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, - 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x19, 0x2e, 0x66, 0x69, 0x6c, 0x65, - 0x2e, 0x41, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x44, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x20, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, - 0x5d, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, - 0x19, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x66, 0x69, 0x6c, - 0x65, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x21, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x1b, 0x3a, 0x01, 0x2a, 0x22, 0x16, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x6a, - 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x79, 0x12, 0x1c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x3a, - 0x01, 0x2a, 0x1a, 0x16, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, - 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x67, 0x0a, 0x0f, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x2e, - 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x79, 0x12, 0xa2, 0x01, 0x0a, 0x11, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1e, 0x2e, 0x66, 0x69, 0x6c, 0x65, - 0x2e, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x66, 0x69, 0x6c, 0x65, - 0x2e, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, - 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x4f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x49, 0x3a, - 0x01, 0x2a, 0x5a, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x2f, 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x22, 0x1b, 0x2f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x2f, 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x12, 0x3e, 0x0a, 0x0a, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x17, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x55, 0x70, - 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x15, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, - 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x08, 0x50, 0x61, 0x67, 0x65, - 0x46, 0x69, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x50, 0x61, 0x67, 0x65, - 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x66, 0x69, - 0x6c, 0x65, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x74, 0x0a, 0x0c, - 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x79, 0x53, 0x68, 0x61, 0x12, 0x19, 0x2e, 0x66, - 0x69, 0x6c, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x79, 0x53, 0x68, 0x61, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0a, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x5a, 0x1e, 0x12, 0x1c, 0x2f, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, - 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x73, 0x68, 0x61, 0x12, 0x15, 0x2f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x73, - 0x68, 0x61, 0x12, 0x5b, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, - 0x12, 0x17, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x1a, 0x11, 0x2f, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x12, - 0x5b, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x17, 0x2e, - 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1c, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x09, 0x5a, 0x07, - 0x2e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_resource_file_service_proto_goTypes = []interface{}{ - (*AllDirectoryRequest)(nil), // 0: file.AllDirectoryRequest - (*AddDirectoryRequest)(nil), // 1: file.AddDirectoryRequest - (*UpdateDirectoryRequest)(nil), // 2: file.UpdateDirectoryRequest - (*DeleteDirectoryRequest)(nil), // 3: file.DeleteDirectoryRequest - (*PrepareUploadFileRequest)(nil), // 4: file.PrepareUploadFileRequest - (*UploadFileRequest)(nil), // 5: file.UploadFileRequest - (*PageFileRequest)(nil), // 6: file.PageFileRequest - (*GetFileByShaRequest)(nil), // 7: file.GetFileByShaRequest - (*UpdateFileRequest)(nil), // 8: file.UpdateFileRequest - (*DeleteFileRequest)(nil), // 9: file.DeleteFileRequest - (*AllDirectoryReply)(nil), // 10: file.AllDirectoryReply - (*Directory)(nil), // 11: file.Directory - (*emptypb.Empty)(nil), // 12: google.protobuf.Empty - (*PrepareUploadFileReply)(nil), // 13: file.PrepareUploadFileReply - (*UploadFileReply)(nil), // 14: file.UploadFileReply - (*PageFileReply)(nil), // 15: file.PageFileReply - (*File)(nil), // 16: file.File -} -var file_resource_file_service_proto_depIdxs = []int32{ - 0, // 0: file.Service.AllDirectory:input_type -> file.AllDirectoryRequest - 1, // 1: file.Service.AddDirectory:input_type -> file.AddDirectoryRequest - 2, // 2: file.Service.UpdateDirectory:input_type -> file.UpdateDirectoryRequest - 3, // 3: file.Service.DeleteDirectory:input_type -> file.DeleteDirectoryRequest - 4, // 4: file.Service.PrepareUploadFile:input_type -> file.PrepareUploadFileRequest - 5, // 5: file.Service.UploadFile:input_type -> file.UploadFileRequest - 6, // 6: file.Service.PageFile:input_type -> file.PageFileRequest - 7, // 7: file.Service.GetFileBySha:input_type -> file.GetFileByShaRequest - 8, // 8: file.Service.UpdateFile:input_type -> file.UpdateFileRequest - 9, // 9: file.Service.DeleteFile:input_type -> file.DeleteFileRequest - 10, // 10: file.Service.AllDirectory:output_type -> file.AllDirectoryReply - 11, // 11: file.Service.AddDirectory:output_type -> file.Directory - 12, // 12: file.Service.UpdateDirectory:output_type -> google.protobuf.Empty - 12, // 13: file.Service.DeleteDirectory:output_type -> google.protobuf.Empty - 13, // 14: file.Service.PrepareUploadFile:output_type -> file.PrepareUploadFileReply - 14, // 15: file.Service.UploadFile:output_type -> file.UploadFileReply - 15, // 16: file.Service.PageFile:output_type -> file.PageFileReply - 16, // 17: file.Service.GetFileBySha:output_type -> file.File - 12, // 18: file.Service.UpdateFile:output_type -> google.protobuf.Empty - 12, // 19: file.Service.DeleteFile:output_type -> google.protobuf.Empty - 10, // [10:20] is the sub-list for method output_type - 0, // [0:10] 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_resource_file_service_proto_init() } -func file_resource_file_service_proto_init() { - if File_resource_file_service_proto != nil { - return - } - file_resource_file_proto_init() - file_resource_directory_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_resource_file_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_resource_file_service_proto_goTypes, - DependencyIndexes: file_resource_file_service_proto_depIdxs, - }.Build() - File_resource_file_service_proto = out.File - file_resource_file_service_proto_rawDesc = nil - file_resource_file_service_proto_goTypes = nil - file_resource_file_service_proto_depIdxs = nil -} diff --git a/api/file/v1/resource_file_service.pb.validate.go b/api/file/v1/resource_file_service.pb.validate.go deleted file mode 100644 index 74c9777..0000000 --- a/api/file/v1/resource_file_service.pb.validate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: resource_file_service.proto - -package v1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) diff --git a/api/file/v1/resource_file_service_grpc.pb.go b/api/file/v1/resource_file_service_grpc.pb.go deleted file mode 100644 index 4b61b21..0000000 --- a/api/file/v1/resource_file_service_grpc.pb.go +++ /dev/null @@ -1,443 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 -// source: resource_file_service.proto - -package v1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// 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 ( - Service_AllDirectory_FullMethodName = "/file.Service/AllDirectory" - Service_AddDirectory_FullMethodName = "/file.Service/AddDirectory" - Service_UpdateDirectory_FullMethodName = "/file.Service/UpdateDirectory" - Service_DeleteDirectory_FullMethodName = "/file.Service/DeleteDirectory" - Service_PrepareUploadFile_FullMethodName = "/file.Service/PrepareUploadFile" - Service_UploadFile_FullMethodName = "/file.Service/UploadFile" - Service_PageFile_FullMethodName = "/file.Service/PageFile" - Service_GetFileBySha_FullMethodName = "/file.Service/GetFileBySha" - Service_UpdateFile_FullMethodName = "/file.Service/UpdateFile" - Service_DeleteFile_FullMethodName = "/file.Service/DeleteFile" -) - -// ServiceClient is the client API for Service 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 ServiceClient interface { - AllDirectory(ctx context.Context, in *AllDirectoryRequest, opts ...grpc.CallOption) (*AllDirectoryReply, error) - AddDirectory(ctx context.Context, in *AddDirectoryRequest, opts ...grpc.CallOption) (*Directory, error) - UpdateDirectory(ctx context.Context, in *UpdateDirectoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - DeleteDirectory(ctx context.Context, in *DeleteDirectoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - PrepareUploadFile(ctx context.Context, in *PrepareUploadFileRequest, opts ...grpc.CallOption) (*PrepareUploadFileReply, error) - UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileReply, error) - PageFile(ctx context.Context, in *PageFileRequest, opts ...grpc.CallOption) (*PageFileReply, error) - GetFileBySha(ctx context.Context, in *GetFileByShaRequest, opts ...grpc.CallOption) (*File, error) - UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) -} - -type serviceClient struct { - cc grpc.ClientConnInterface -} - -func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient { - return &serviceClient{cc} -} - -func (c *serviceClient) AllDirectory(ctx context.Context, in *AllDirectoryRequest, opts ...grpc.CallOption) (*AllDirectoryReply, error) { - out := new(AllDirectoryReply) - err := c.cc.Invoke(ctx, Service_AllDirectory_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AddDirectory(ctx context.Context, in *AddDirectoryRequest, opts ...grpc.CallOption) (*Directory, error) { - out := new(Directory) - err := c.cc.Invoke(ctx, Service_AddDirectory_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) UpdateDirectory(ctx context.Context, in *UpdateDirectoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Service_UpdateDirectory_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteDirectory(ctx context.Context, in *DeleteDirectoryRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Service_DeleteDirectory_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) PrepareUploadFile(ctx context.Context, in *PrepareUploadFileRequest, opts ...grpc.CallOption) (*PrepareUploadFileReply, error) { - out := new(PrepareUploadFileReply) - err := c.cc.Invoke(ctx, Service_PrepareUploadFile_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileReply, error) { - out := new(UploadFileReply) - err := c.cc.Invoke(ctx, Service_UploadFile_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) PageFile(ctx context.Context, in *PageFileRequest, opts ...grpc.CallOption) (*PageFileReply, error) { - out := new(PageFileReply) - err := c.cc.Invoke(ctx, Service_PageFile_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetFileBySha(ctx context.Context, in *GetFileByShaRequest, opts ...grpc.CallOption) (*File, error) { - out := new(File) - err := c.cc.Invoke(ctx, Service_GetFileBySha_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Service_UpdateFile_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Service_DeleteFile_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ServiceServer is the server API for Service service. -// All implementations must embed UnimplementedServiceServer -// for forward compatibility -type ServiceServer interface { - AllDirectory(context.Context, *AllDirectoryRequest) (*AllDirectoryReply, error) - AddDirectory(context.Context, *AddDirectoryRequest) (*Directory, error) - UpdateDirectory(context.Context, *UpdateDirectoryRequest) (*emptypb.Empty, error) - DeleteDirectory(context.Context, *DeleteDirectoryRequest) (*emptypb.Empty, error) - PrepareUploadFile(context.Context, *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) - UploadFile(context.Context, *UploadFileRequest) (*UploadFileReply, error) - PageFile(context.Context, *PageFileRequest) (*PageFileReply, error) - GetFileBySha(context.Context, *GetFileByShaRequest) (*File, error) - UpdateFile(context.Context, *UpdateFileRequest) (*emptypb.Empty, error) - DeleteFile(context.Context, *DeleteFileRequest) (*emptypb.Empty, error) - mustEmbedUnimplementedServiceServer() -} - -// UnimplementedServiceServer must be embedded to have forward compatible implementations. -type UnimplementedServiceServer struct { -} - -func (UnimplementedServiceServer) AllDirectory(context.Context, *AllDirectoryRequest) (*AllDirectoryReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllDirectory not implemented") -} -func (UnimplementedServiceServer) AddDirectory(context.Context, *AddDirectoryRequest) (*Directory, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddDirectory not implemented") -} -func (UnimplementedServiceServer) UpdateDirectory(context.Context, *UpdateDirectoryRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateDirectory not implemented") -} -func (UnimplementedServiceServer) DeleteDirectory(context.Context, *DeleteDirectoryRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteDirectory not implemented") -} -func (UnimplementedServiceServer) PrepareUploadFile(context.Context, *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PrepareUploadFile not implemented") -} -func (UnimplementedServiceServer) UploadFile(context.Context, *UploadFileRequest) (*UploadFileReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method UploadFile not implemented") -} -func (UnimplementedServiceServer) PageFile(context.Context, *PageFileRequest) (*PageFileReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PageFile not implemented") -} -func (UnimplementedServiceServer) GetFileBySha(context.Context, *GetFileByShaRequest) (*File, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFileBySha not implemented") -} -func (UnimplementedServiceServer) UpdateFile(context.Context, *UpdateFileRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateFile not implemented") -} -func (UnimplementedServiceServer) DeleteFile(context.Context, *DeleteFileRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteFile not implemented") -} -func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {} - -// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ServiceServer will -// result in compilation errors. -type UnsafeServiceServer interface { - mustEmbedUnimplementedServiceServer() -} - -func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer) { - s.RegisterService(&Service_ServiceDesc, srv) -} - -func _Service_AllDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AllDirectoryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).AllDirectory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_AllDirectory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).AllDirectory(ctx, req.(*AllDirectoryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_AddDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddDirectoryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).AddDirectory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_AddDirectory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).AddDirectory(ctx, req.(*AddDirectoryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_UpdateDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateDirectoryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).UpdateDirectory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_UpdateDirectory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).UpdateDirectory(ctx, req.(*UpdateDirectoryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_DeleteDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteDirectoryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).DeleteDirectory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_DeleteDirectory_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).DeleteDirectory(ctx, req.(*DeleteDirectoryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_PrepareUploadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PrepareUploadFileRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).PrepareUploadFile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_PrepareUploadFile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).PrepareUploadFile(ctx, req.(*PrepareUploadFileRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_UploadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UploadFileRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).UploadFile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_UploadFile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).UploadFile(ctx, req.(*UploadFileRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_PageFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PageFileRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).PageFile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_PageFile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).PageFile(ctx, req.(*PageFileRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_GetFileBySha_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFileByShaRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).GetFileBySha(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_GetFileBySha_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).GetFileBySha(ctx, req.(*GetFileByShaRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_UpdateFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateFileRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).UpdateFile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_UpdateFile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).UpdateFile(ctx, req.(*UpdateFileRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Service_DeleteFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteFileRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServiceServer).DeleteFile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Service_DeleteFile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).DeleteFile(ctx, req.(*DeleteFileRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Service_ServiceDesc is the grpc.ServiceDesc for Service service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Service_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "file.Service", - HandlerType: (*ServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AllDirectory", - Handler: _Service_AllDirectory_Handler, - }, - { - MethodName: "AddDirectory", - Handler: _Service_AddDirectory_Handler, - }, - { - MethodName: "UpdateDirectory", - Handler: _Service_UpdateDirectory_Handler, - }, - { - MethodName: "DeleteDirectory", - Handler: _Service_DeleteDirectory_Handler, - }, - { - MethodName: "PrepareUploadFile", - Handler: _Service_PrepareUploadFile_Handler, - }, - { - MethodName: "UploadFile", - Handler: _Service_UploadFile_Handler, - }, - { - MethodName: "PageFile", - Handler: _Service_PageFile_Handler, - }, - { - MethodName: "GetFileBySha", - Handler: _Service_GetFileBySha_Handler, - }, - { - MethodName: "UpdateFile", - Handler: _Service_UpdateFile_Handler, - }, - { - MethodName: "DeleteFile", - Handler: _Service_DeleteFile_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "resource_file_service.proto", -} diff --git a/api/file/v1/resource_file_service_http.pb.go b/api/file/v1/resource_file_service_http.pb.go deleted file mode 100644 index 3ef29cf..0000000 --- a/api/file/v1/resource_file_service_http.pb.go +++ /dev/null @@ -1,422 +0,0 @@ -// Code generated by protoc-gen-go-http. DO NOT EDIT. -// versions: -// - protoc-gen-go-http v2.7.0 -// - protoc v4.24.4 -// source: resource_file_service.proto - -package v1 - -import ( - context "context" - http "github.com/go-kratos/kratos/v2/transport/http" - binding "github.com/go-kratos/kratos/v2/transport/http/binding" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the kratos package it is being compiled against. -var _ = new(context.Context) -var _ = binding.EncodeURL - -const _ = http.SupportPackageIsVersion1 - -const OperationServiceAddDirectory = "/file.Service/AddDirectory" -const OperationServiceAllDirectory = "/file.Service/AllDirectory" -const OperationServiceDeleteDirectory = "/file.Service/DeleteDirectory" -const OperationServiceDeleteFile = "/file.Service/DeleteFile" -const OperationServiceGetFileBySha = "/file.Service/GetFileBySha" -const OperationServicePageFile = "/file.Service/PageFile" -const OperationServicePrepareUploadFile = "/file.Service/PrepareUploadFile" -const OperationServiceUpdateDirectory = "/file.Service/UpdateDirectory" -const OperationServiceUpdateFile = "/file.Service/UpdateFile" - -type ServiceHTTPServer interface { - AddDirectory(context.Context, *AddDirectoryRequest) (*Directory, error) - AllDirectory(context.Context, *AllDirectoryRequest) (*AllDirectoryReply, error) - DeleteDirectory(context.Context, *DeleteDirectoryRequest) (*emptypb.Empty, error) - DeleteFile(context.Context, *DeleteFileRequest) (*emptypb.Empty, error) - GetFileBySha(context.Context, *GetFileByShaRequest) (*File, error) - PageFile(context.Context, *PageFileRequest) (*PageFileReply, error) - PrepareUploadFile(context.Context, *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) - UpdateDirectory(context.Context, *UpdateDirectoryRequest) (*emptypb.Empty, error) - UpdateFile(context.Context, *UpdateFileRequest) (*emptypb.Empty, error) -} - -func RegisterServiceHTTPServer(s *http.Server, srv ServiceHTTPServer) { - r := s.Route("/") - r.GET("/resource/v1/directories", _Service_AllDirectory0_HTTP_Handler(srv)) - r.POST("/resource/v1/directory", _Service_AddDirectory0_HTTP_Handler(srv)) - r.PUT("/resource/v1/directory", _Service_UpdateDirectory0_HTTP_Handler(srv)) - r.DELETE("/resource/v1/directory", _Service_DeleteDirectory0_HTTP_Handler(srv)) - r.POST("/resource/client/v1/upload/prepare", _Service_PrepareUploadFile0_HTTP_Handler(srv)) - r.POST("/resource/v1/upload/prepare", _Service_PrepareUploadFile1_HTTP_Handler(srv)) - r.GET("/resource/v1/files", _Service_PageFile0_HTTP_Handler(srv)) - r.GET("/resource/client/v1/file/sha", _Service_GetFileBySha0_HTTP_Handler(srv)) - r.GET("/resource/v1/file/sha", _Service_GetFileBySha1_HTTP_Handler(srv)) - r.PUT("/resource/v1/file", _Service_UpdateFile0_HTTP_Handler(srv)) - r.POST("/resource/v1/file", _Service_DeleteFile0_HTTP_Handler(srv)) -} - -func _Service_AllDirectory0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in AllDirectoryRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceAllDirectory) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.AllDirectory(ctx, req.(*AllDirectoryRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*AllDirectoryReply) - return ctx.Result(200, reply) - } -} - -func _Service_AddDirectory0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in AddDirectoryRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceAddDirectory) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.AddDirectory(ctx, req.(*AddDirectoryRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*Directory) - return ctx.Result(200, reply) - } -} - -func _Service_UpdateDirectory0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in UpdateDirectoryRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceUpdateDirectory) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.UpdateDirectory(ctx, req.(*UpdateDirectoryRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*emptypb.Empty) - return ctx.Result(200, reply) - } -} - -func _Service_DeleteDirectory0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in DeleteDirectoryRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceDeleteDirectory) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.DeleteDirectory(ctx, req.(*DeleteDirectoryRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*emptypb.Empty) - return ctx.Result(200, reply) - } -} - -func _Service_PrepareUploadFile0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in PrepareUploadFileRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServicePrepareUploadFile) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.PrepareUploadFile(ctx, req.(*PrepareUploadFileRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*PrepareUploadFileReply) - return ctx.Result(200, reply) - } -} - -func _Service_PrepareUploadFile1_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in PrepareUploadFileRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServicePrepareUploadFile) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.PrepareUploadFile(ctx, req.(*PrepareUploadFileRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*PrepareUploadFileReply) - return ctx.Result(200, reply) - } -} - -func _Service_PageFile0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in PageFileRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServicePageFile) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.PageFile(ctx, req.(*PageFileRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*PageFileReply) - return ctx.Result(200, reply) - } -} - -func _Service_GetFileBySha0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in GetFileByShaRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceGetFileBySha) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.GetFileBySha(ctx, req.(*GetFileByShaRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*File) - return ctx.Result(200, reply) - } -} - -func _Service_GetFileBySha1_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in GetFileByShaRequest - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceGetFileBySha) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.GetFileBySha(ctx, req.(*GetFileByShaRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*File) - return ctx.Result(200, reply) - } -} - -func _Service_UpdateFile0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in UpdateFileRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceUpdateFile) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.UpdateFile(ctx, req.(*UpdateFileRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*emptypb.Empty) - return ctx.Result(200, reply) - } -} - -func _Service_DeleteFile0_HTTP_Handler(srv ServiceHTTPServer) func(ctx http.Context) error { - return func(ctx http.Context) error { - var in DeleteFileRequest - if err := ctx.Bind(&in); err != nil { - return err - } - if err := ctx.BindQuery(&in); err != nil { - return err - } - http.SetOperation(ctx, OperationServiceDeleteFile) - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.DeleteFile(ctx, req.(*DeleteFileRequest)) - }) - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*emptypb.Empty) - return ctx.Result(200, reply) - } -} - -type ServiceHTTPClient interface { - AddDirectory(ctx context.Context, req *AddDirectoryRequest, opts ...http.CallOption) (rsp *Directory, err error) - AllDirectory(ctx context.Context, req *AllDirectoryRequest, opts ...http.CallOption) (rsp *AllDirectoryReply, err error) - DeleteDirectory(ctx context.Context, req *DeleteDirectoryRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error) - DeleteFile(ctx context.Context, req *DeleteFileRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error) - GetFileBySha(ctx context.Context, req *GetFileByShaRequest, opts ...http.CallOption) (rsp *File, err error) - PageFile(ctx context.Context, req *PageFileRequest, opts ...http.CallOption) (rsp *PageFileReply, err error) - PrepareUploadFile(ctx context.Context, req *PrepareUploadFileRequest, opts ...http.CallOption) (rsp *PrepareUploadFileReply, err error) - UpdateDirectory(ctx context.Context, req *UpdateDirectoryRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error) - UpdateFile(ctx context.Context, req *UpdateFileRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error) -} - -type ServiceHTTPClientImpl struct { - cc *http.Client -} - -func NewServiceHTTPClient(client *http.Client) ServiceHTTPClient { - return &ServiceHTTPClientImpl{client} -} - -func (c *ServiceHTTPClientImpl) AddDirectory(ctx context.Context, in *AddDirectoryRequest, opts ...http.CallOption) (*Directory, error) { - var out Directory - pattern := "/resource/v1/directory" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationServiceAddDirectory)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) AllDirectory(ctx context.Context, in *AllDirectoryRequest, opts ...http.CallOption) (*AllDirectoryReply, error) { - var out AllDirectoryReply - pattern := "/resource/v1/directories" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationServiceAllDirectory)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) DeleteDirectory(ctx context.Context, in *DeleteDirectoryRequest, opts ...http.CallOption) (*emptypb.Empty, error) { - var out emptypb.Empty - pattern := "/resource/v1/directory" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationServiceDeleteDirectory)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...http.CallOption) (*emptypb.Empty, error) { - var out emptypb.Empty - pattern := "/resource/v1/file" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationServiceDeleteFile)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) GetFileBySha(ctx context.Context, in *GetFileByShaRequest, opts ...http.CallOption) (*File, error) { - var out File - pattern := "/resource/v1/file/sha" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationServiceGetFileBySha)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) PageFile(ctx context.Context, in *PageFileRequest, opts ...http.CallOption) (*PageFileReply, error) { - var out PageFileReply - pattern := "/resource/v1/files" - path := binding.EncodeURL(pattern, in, true) - opts = append(opts, http.Operation(OperationServicePageFile)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) PrepareUploadFile(ctx context.Context, in *PrepareUploadFileRequest, opts ...http.CallOption) (*PrepareUploadFileReply, error) { - var out PrepareUploadFileReply - pattern := "/resource/v1/upload/prepare" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationServicePrepareUploadFile)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) UpdateDirectory(ctx context.Context, in *UpdateDirectoryRequest, opts ...http.CallOption) (*emptypb.Empty, error) { - var out emptypb.Empty - pattern := "/resource/v1/directory" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationServiceUpdateDirectory)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "PUT", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} - -func (c *ServiceHTTPClientImpl) UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...http.CallOption) (*emptypb.Empty, error) { - var out emptypb.Empty - pattern := "/resource/v1/file" - path := binding.EncodeURL(pattern, in, false) - opts = append(opts, http.Operation(OperationServiceUpdateFile)) - opts = append(opts, http.PathTemplate(pattern)) - err := c.cc.Invoke(ctx, "PUT", path, in, &out, opts...) - if err != nil { - return nil, err - } - return &out, err -} diff --git a/api/errors/openapi.yaml b/api/resource/directory/openapi.yaml similarity index 100% rename from api/errors/openapi.yaml rename to api/resource/directory/openapi.yaml diff --git a/api/resource/directory/resource_directory.proto b/api/resource/directory/resource_directory.proto new file mode 100755 index 0000000..5006984 --- /dev/null +++ b/api/resource/directory/resource_directory.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; + +package resource.api.resource.directory.v1; + +option go_package = "./v1;v1"; +option java_multiple_files = true; +option java_package = "resource.api.resource.directory.v1"; +option java_outer_classname = "DirectoryV1"; + +import "validate/validate.proto"; + +message GetDirectoryRequest { + optional uint32 id = 1[(validate.rules).uint32 = {gt: 0}]; +} + +message GetDirectoryReply { + uint32 id = 1; + uint32 parentId = 2; + string name = 3; + string accept = 4; + uint32 maxSize = 5; + uint32 createdAt = 6; + uint32 updatedAt = 7; +} + +message ListDirectoryRequest { + optional string order = 1[(validate.rules).string = {in: ["asc","desc"]}]; + optional string orderBy = 2[(validate.rules).string = {in: ["id","created_at","updated_at"]}]; +} + +message ListDirectoryReply { + message Directory { + uint32 id = 1; + uint32 parentId = 2; + string name = 3; + string accept = 4; + uint32 maxSize = 5; + uint32 createdAt = 6; + uint32 updatedAt = 7; + repeated Directory children = 8; + } + + uint32 total = 1; + repeated Directory list = 2; +} + +message CreateDirectoryRequest { + uint32 parentId = 1[(validate.rules).uint32 = {gt: 0}]; + string name = 2[(validate.rules).string = {min_len: 1}]; + string accept = 3[(validate.rules).string = {min_len: 1}]; + uint32 maxSize = 4[(validate.rules).uint32 = {gte: 1}]; +} + +message CreateDirectoryReply { + uint32 id = 1; +} + +message UpdateDirectoryRequest { + uint32 id = 1[(validate.rules).uint32 = {gt: 0}]; + uint32 parentId = 2[(validate.rules).uint32 = {gt: 0}]; + string name = 3[(validate.rules).string = {min_len: 1}]; + string accept = 4[(validate.rules).string = {min_len: 1}]; + uint32 maxSize = 5[(validate.rules).uint32 = {gte: 1}]; +} + +message UpdateDirectoryReply { +} + +message DeleteDirectoryRequest { + repeated uint32 ids = 1[(validate.rules).repeated = {min_items: 1, unique:true, max_items:50}]; +} + +message DeleteDirectoryReply { + uint32 total = 1; +} + diff --git a/api/resource/directory/resource_directory_service.proto b/api/resource/directory/resource_directory_service.proto new file mode 100755 index 0000000..47a9933 --- /dev/null +++ b/api/resource/directory/resource_directory_service.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package resource.api.resource.directory.v1; + +option go_package = "./v1;v1"; +option java_multiple_files = true; +option java_package = "resource.api.resource.directory.v1"; +option java_outer_classname = "DirectoryV1"; + +import "api/resource/directory/resource_directory.proto"; +import "google/api/annotations.proto"; + +service Directory{ + + // GetDirectory 获取指定的文件目录信息 + rpc GetDirectory (GetDirectoryRequest) returns (GetDirectoryReply) { + option (google.api.http) = { + get: "/resource/api/v1/directory", + }; + } + + // ListDirectory 获取文件目录信息列表 + rpc ListDirectory (ListDirectoryRequest) returns (ListDirectoryReply) { + option (google.api.http) = { + get: "/resource/api/v1/directories", + }; + } + + // CreateDirectory 创建文件目录信息 + rpc CreateDirectory (CreateDirectoryRequest) returns (CreateDirectoryReply) { + option (google.api.http) = { + post: "/resource/api/v1/directory", + body: "*" + }; + } + + // UpdateDirectory 更新文件目录信息 + rpc UpdateDirectory (UpdateDirectoryRequest) returns (UpdateDirectoryReply) { + option (google.api.http) = { + put: "/resource/api/v1/directory", + body: "*" + }; + } + + // DeleteDirectory 删除文件目录信息 + rpc DeleteDirectory (DeleteDirectoryRequest) returns (DeleteDirectoryReply) { + option (google.api.http) = { + delete: "/resource/api/v1/directory", + }; + } + +} \ No newline at end of file diff --git a/api/resource/directory/v1/resource_directory.pb.go b/api/resource/directory/v1/resource_directory.pb.go new file mode 100644 index 0000000..9d35b65 --- /dev/null +++ b/api/resource/directory/v1/resource_directory.pb.go @@ -0,0 +1,1004 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: api/resource/directory/resource_directory.proto + +package v1 + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + 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) +) + +type GetDirectoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"` +} + +func (x *GetDirectoryRequest) Reset() { + *x = GetDirectoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDirectoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDirectoryRequest) ProtoMessage() {} + +func (x *GetDirectoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_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 GetDirectoryRequest.ProtoReflect.Descriptor instead. +func (*GetDirectoryRequest) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{0} +} + +func (x *GetDirectoryRequest) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +type GetDirectoryReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + ParentId uint32 `protobuf:"varint,2,opt,name=parentId,proto3" json:"parentId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Accept string `protobuf:"bytes,4,opt,name=accept,proto3" json:"accept,omitempty"` + MaxSize uint32 `protobuf:"varint,5,opt,name=maxSize,proto3" json:"maxSize,omitempty"` + CreatedAt uint32 `protobuf:"varint,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt uint32 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` +} + +func (x *GetDirectoryReply) Reset() { + *x = GetDirectoryReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDirectoryReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDirectoryReply) ProtoMessage() {} + +func (x *GetDirectoryReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[1] + 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 GetDirectoryReply.ProtoReflect.Descriptor instead. +func (*GetDirectoryReply) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{1} +} + +func (x *GetDirectoryReply) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *GetDirectoryReply) GetParentId() uint32 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *GetDirectoryReply) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetDirectoryReply) GetAccept() string { + if x != nil { + return x.Accept + } + return "" +} + +func (x *GetDirectoryReply) GetMaxSize() uint32 { + if x != nil { + return x.MaxSize + } + return 0 +} + +func (x *GetDirectoryReply) GetCreatedAt() uint32 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *GetDirectoryReply) GetUpdatedAt() uint32 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +type ListDirectoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Order *string `protobuf:"bytes,1,opt,name=order,proto3,oneof" json:"order,omitempty"` + OrderBy *string `protobuf:"bytes,2,opt,name=orderBy,proto3,oneof" json:"orderBy,omitempty"` +} + +func (x *ListDirectoryRequest) Reset() { + *x = ListDirectoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDirectoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDirectoryRequest) ProtoMessage() {} + +func (x *ListDirectoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[2] + 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 ListDirectoryRequest.ProtoReflect.Descriptor instead. +func (*ListDirectoryRequest) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{2} +} + +func (x *ListDirectoryRequest) GetOrder() string { + if x != nil && x.Order != nil { + return *x.Order + } + return "" +} + +func (x *ListDirectoryRequest) GetOrderBy() string { + if x != nil && x.OrderBy != nil { + return *x.OrderBy + } + return "" +} + +type ListDirectoryReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*ListDirectoryReply_Directory `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListDirectoryReply) Reset() { + *x = ListDirectoryReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDirectoryReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDirectoryReply) ProtoMessage() {} + +func (x *ListDirectoryReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[3] + 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 ListDirectoryReply.ProtoReflect.Descriptor instead. +func (*ListDirectoryReply) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{3} +} + +func (x *ListDirectoryReply) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListDirectoryReply) GetList() []*ListDirectoryReply_Directory { + if x != nil { + return x.List + } + return nil +} + +type CreateDirectoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ParentId uint32 `protobuf:"varint,1,opt,name=parentId,proto3" json:"parentId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Accept string `protobuf:"bytes,3,opt,name=accept,proto3" json:"accept,omitempty"` + MaxSize uint32 `protobuf:"varint,4,opt,name=maxSize,proto3" json:"maxSize,omitempty"` +} + +func (x *CreateDirectoryRequest) Reset() { + *x = CreateDirectoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateDirectoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDirectoryRequest) ProtoMessage() {} + +func (x *CreateDirectoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[4] + 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 CreateDirectoryRequest.ProtoReflect.Descriptor instead. +func (*CreateDirectoryRequest) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateDirectoryRequest) GetParentId() uint32 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *CreateDirectoryRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateDirectoryRequest) GetAccept() string { + if x != nil { + return x.Accept + } + return "" +} + +func (x *CreateDirectoryRequest) GetMaxSize() uint32 { + if x != nil { + return x.MaxSize + } + return 0 +} + +type CreateDirectoryReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CreateDirectoryReply) Reset() { + *x = CreateDirectoryReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateDirectoryReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDirectoryReply) ProtoMessage() {} + +func (x *CreateDirectoryReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[5] + 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 CreateDirectoryReply.ProtoReflect.Descriptor instead. +func (*CreateDirectoryReply) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateDirectoryReply) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +type UpdateDirectoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + ParentId uint32 `protobuf:"varint,2,opt,name=parentId,proto3" json:"parentId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Accept string `protobuf:"bytes,4,opt,name=accept,proto3" json:"accept,omitempty"` + MaxSize uint32 `protobuf:"varint,5,opt,name=maxSize,proto3" json:"maxSize,omitempty"` +} + +func (x *UpdateDirectoryRequest) Reset() { + *x = UpdateDirectoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDirectoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDirectoryRequest) ProtoMessage() {} + +func (x *UpdateDirectoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[6] + 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 UpdateDirectoryRequest.ProtoReflect.Descriptor instead. +func (*UpdateDirectoryRequest) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateDirectoryRequest) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UpdateDirectoryRequest) GetParentId() uint32 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *UpdateDirectoryRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateDirectoryRequest) GetAccept() string { + if x != nil { + return x.Accept + } + return "" +} + +func (x *UpdateDirectoryRequest) GetMaxSize() uint32 { + if x != nil { + return x.MaxSize + } + return 0 +} + +type UpdateDirectoryReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateDirectoryReply) Reset() { + *x = UpdateDirectoryReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDirectoryReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDirectoryReply) ProtoMessage() {} + +func (x *UpdateDirectoryReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[7] + 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 UpdateDirectoryReply.ProtoReflect.Descriptor instead. +func (*UpdateDirectoryReply) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{7} +} + +type DeleteDirectoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ids []uint32 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"` +} + +func (x *DeleteDirectoryRequest) Reset() { + *x = DeleteDirectoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteDirectoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDirectoryRequest) ProtoMessage() {} + +func (x *DeleteDirectoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[8] + 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 DeleteDirectoryRequest.ProtoReflect.Descriptor instead. +func (*DeleteDirectoryRequest) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteDirectoryRequest) GetIds() []uint32 { + if x != nil { + return x.Ids + } + return nil +} + +type DeleteDirectoryReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` +} + +func (x *DeleteDirectoryReply) Reset() { + *x = DeleteDirectoryReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteDirectoryReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDirectoryReply) ProtoMessage() {} + +func (x *DeleteDirectoryReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[9] + 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 DeleteDirectoryReply.ProtoReflect.Descriptor instead. +func (*DeleteDirectoryReply) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteDirectoryReply) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +type ListDirectoryReply_Directory struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + ParentId uint32 `protobuf:"varint,2,opt,name=parentId,proto3" json:"parentId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Accept string `protobuf:"bytes,4,opt,name=accept,proto3" json:"accept,omitempty"` + MaxSize uint32 `protobuf:"varint,5,opt,name=maxSize,proto3" json:"maxSize,omitempty"` + CreatedAt uint32 `protobuf:"varint,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt uint32 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` + Children []*ListDirectoryReply_Directory `protobuf:"bytes,8,rep,name=children,proto3" json:"children,omitempty"` +} + +func (x *ListDirectoryReply_Directory) Reset() { + *x = ListDirectoryReply_Directory{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDirectoryReply_Directory) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDirectoryReply_Directory) ProtoMessage() {} + +func (x *ListDirectoryReply_Directory) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_directory_resource_directory_proto_msgTypes[10] + 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 ListDirectoryReply_Directory.ProtoReflect.Descriptor instead. +func (*ListDirectoryReply_Directory) Descriptor() ([]byte, []int) { + return file_api_resource_directory_resource_directory_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *ListDirectoryReply_Directory) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ListDirectoryReply_Directory) GetParentId() uint32 { + if x != nil { + return x.ParentId + } + return 0 +} + +func (x *ListDirectoryReply_Directory) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ListDirectoryReply_Directory) GetAccept() string { + if x != nil { + return x.Accept + } + return "" +} + +func (x *ListDirectoryReply_Directory) GetMaxSize() uint32 { + if x != nil { + return x.MaxSize + } + return 0 +} + +func (x *ListDirectoryReply_Directory) GetCreatedAt() uint32 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ListDirectoryReply_Directory) GetUpdatedAt() uint32 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *ListDirectoryReply_Directory) GetChildren() []*ListDirectoryReply_Directory { + if x != nil { + return x.Children + } + return nil +} + +var File_api_resource_directory_resource_directory_proto protoreflect.FileDescriptor + +var file_api_resource_directory_resource_directory_proto_rawDesc = []byte{ + 0x0a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x22, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, + 0x0a, 0x13, 0x47, 0x65, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, + 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x22, 0xc1, 0x01, 0x0a, 0x11, 0x47, + 0x65, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x53, + 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x9b, + 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x72, 0x0b, 0x52, 0x03, 0x61, + 0x73, 0x63, 0x52, 0x04, 0x64, 0x65, 0x73, 0x63, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x88, 0x01, 0x01, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xfa, 0x42, 0x1e, 0x72, 0x1c, 0x52, 0x02, 0x69, 0x64, + 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x52, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x48, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x42, 0x79, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x22, 0x9a, 0x03, 0x0a, + 0x12, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x54, 0x0a, 0x04, 0x6c, 0x69, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, + 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x1a, + 0x97, 0x02, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x5c, 0x0a, 0x08, 0x63, + 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0x9e, 0x01, 0x0a, 0x16, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, + 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, + 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x28, + 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x26, 0x0a, 0x14, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, + 0x69, 0x64, 0x22, 0xb7, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, + 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, + 0x00, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x06, 0x61, 0x63, 0x63, 0x65, + 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, 0x21, 0x0a, 0x07, 0x6d, 0x61, 0x78, + 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, + 0x02, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x16, 0x0a, 0x14, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x38, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, + 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x0c, 0xfa, 0x42, 0x09, + 0x92, 0x01, 0x06, 0x08, 0x01, 0x10, 0x32, 0x18, 0x01, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x2c, + 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x3c, 0x0a, 0x22, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x42, 0x0b, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x56, 0x31, 0x50, + 0x01, 0x5a, 0x07, 0x2e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_api_resource_directory_resource_directory_proto_rawDescOnce sync.Once + file_api_resource_directory_resource_directory_proto_rawDescData = file_api_resource_directory_resource_directory_proto_rawDesc +) + +func file_api_resource_directory_resource_directory_proto_rawDescGZIP() []byte { + file_api_resource_directory_resource_directory_proto_rawDescOnce.Do(func() { + file_api_resource_directory_resource_directory_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_resource_directory_resource_directory_proto_rawDescData) + }) + return file_api_resource_directory_resource_directory_proto_rawDescData +} + +var file_api_resource_directory_resource_directory_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_api_resource_directory_resource_directory_proto_goTypes = []interface{}{ + (*GetDirectoryRequest)(nil), // 0: resource.api.resource.directory.v1.GetDirectoryRequest + (*GetDirectoryReply)(nil), // 1: resource.api.resource.directory.v1.GetDirectoryReply + (*ListDirectoryRequest)(nil), // 2: resource.api.resource.directory.v1.ListDirectoryRequest + (*ListDirectoryReply)(nil), // 3: resource.api.resource.directory.v1.ListDirectoryReply + (*CreateDirectoryRequest)(nil), // 4: resource.api.resource.directory.v1.CreateDirectoryRequest + (*CreateDirectoryReply)(nil), // 5: resource.api.resource.directory.v1.CreateDirectoryReply + (*UpdateDirectoryRequest)(nil), // 6: resource.api.resource.directory.v1.UpdateDirectoryRequest + (*UpdateDirectoryReply)(nil), // 7: resource.api.resource.directory.v1.UpdateDirectoryReply + (*DeleteDirectoryRequest)(nil), // 8: resource.api.resource.directory.v1.DeleteDirectoryRequest + (*DeleteDirectoryReply)(nil), // 9: resource.api.resource.directory.v1.DeleteDirectoryReply + (*ListDirectoryReply_Directory)(nil), // 10: resource.api.resource.directory.v1.ListDirectoryReply.Directory +} +var file_api_resource_directory_resource_directory_proto_depIdxs = []int32{ + 10, // 0: resource.api.resource.directory.v1.ListDirectoryReply.list:type_name -> resource.api.resource.directory.v1.ListDirectoryReply.Directory + 10, // 1: resource.api.resource.directory.v1.ListDirectoryReply.Directory.children:type_name -> resource.api.resource.directory.v1.ListDirectoryReply.Directory + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_api_resource_directory_resource_directory_proto_init() } +func file_api_resource_directory_resource_directory_proto_init() { + if File_api_resource_directory_resource_directory_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_resource_directory_resource_directory_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDirectoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDirectoryReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDirectoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDirectoryReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateDirectoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateDirectoryReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDirectoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDirectoryReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteDirectoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteDirectoryReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDirectoryReply_Directory); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_api_resource_directory_resource_directory_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_api_resource_directory_resource_directory_proto_msgTypes[2].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_resource_directory_resource_directory_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_resource_directory_resource_directory_proto_goTypes, + DependencyIndexes: file_api_resource_directory_resource_directory_proto_depIdxs, + MessageInfos: file_api_resource_directory_resource_directory_proto_msgTypes, + }.Build() + File_api_resource_directory_resource_directory_proto = out.File + file_api_resource_directory_resource_directory_proto_rawDesc = nil + file_api_resource_directory_resource_directory_proto_goTypes = nil + file_api_resource_directory_resource_directory_proto_depIdxs = nil +} diff --git a/api/resource/directory/v1/resource_directory.pb.validate.go b/api/resource/directory/v1/resource_directory.pb.validate.go new file mode 100644 index 0000000..06b45d7 --- /dev/null +++ b/api/resource/directory/v1/resource_directory.pb.validate.go @@ -0,0 +1,1448 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: api/resource/directory/resource_directory.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on GetDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetDirectoryRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetDirectoryRequestMultiError, or nil if none found. +func (m *GetDirectoryRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetDirectoryRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.Id != nil { + + if m.GetId() <= 0 { + err := GetDirectoryRequestValidationError{ + field: "Id", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return GetDirectoryRequestMultiError(errors) + } + + return nil +} + +// GetDirectoryRequestMultiError is an error wrapping multiple validation +// errors returned by GetDirectoryRequest.ValidateAll() if the designated +// constraints aren't met. +type GetDirectoryRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetDirectoryRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetDirectoryRequestMultiError) AllErrors() []error { return m } + +// GetDirectoryRequestValidationError is the validation error returned by +// GetDirectoryRequest.Validate if the designated constraints aren't met. +type GetDirectoryRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetDirectoryRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetDirectoryRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetDirectoryRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetDirectoryRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetDirectoryRequestValidationError) ErrorName() string { + return "GetDirectoryRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetDirectoryRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetDirectoryRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetDirectoryRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetDirectoryRequestValidationError{} + +// Validate checks the field values on GetDirectoryReply with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *GetDirectoryReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetDirectoryReplyMultiError, or nil if none found. +func (m *GetDirectoryReply) ValidateAll() error { + return m.validate(true) +} + +func (m *GetDirectoryReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for ParentId + + // no validation rules for Name + + // no validation rules for Accept + + // no validation rules for MaxSize + + // no validation rules for CreatedAt + + // no validation rules for UpdatedAt + + if len(errors) > 0 { + return GetDirectoryReplyMultiError(errors) + } + + return nil +} + +// GetDirectoryReplyMultiError is an error wrapping multiple validation errors +// returned by GetDirectoryReply.ValidateAll() if the designated constraints +// aren't met. +type GetDirectoryReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetDirectoryReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetDirectoryReplyMultiError) AllErrors() []error { return m } + +// GetDirectoryReplyValidationError is the validation error returned by +// GetDirectoryReply.Validate if the designated constraints aren't met. +type GetDirectoryReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetDirectoryReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetDirectoryReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetDirectoryReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetDirectoryReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetDirectoryReplyValidationError) ErrorName() string { + return "GetDirectoryReplyValidationError" +} + +// Error satisfies the builtin error interface +func (e GetDirectoryReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetDirectoryReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetDirectoryReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetDirectoryReplyValidationError{} + +// Validate checks the field values on ListDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListDirectoryRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListDirectoryRequestMultiError, or nil if none found. +func (m *ListDirectoryRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListDirectoryRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.Order != nil { + + if _, ok := _ListDirectoryRequest_Order_InLookup[m.GetOrder()]; !ok { + err := ListDirectoryRequestValidationError{ + field: "Order", + reason: "value must be in list [asc desc]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.OrderBy != nil { + + if _, ok := _ListDirectoryRequest_OrderBy_InLookup[m.GetOrderBy()]; !ok { + err := ListDirectoryRequestValidationError{ + field: "OrderBy", + reason: "value must be in list [id created_at updated_at]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return ListDirectoryRequestMultiError(errors) + } + + return nil +} + +// ListDirectoryRequestMultiError is an error wrapping multiple validation +// errors returned by ListDirectoryRequest.ValidateAll() if the designated +// constraints aren't met. +type ListDirectoryRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListDirectoryRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListDirectoryRequestMultiError) AllErrors() []error { return m } + +// ListDirectoryRequestValidationError is the validation error returned by +// ListDirectoryRequest.Validate if the designated constraints aren't met. +type ListDirectoryRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListDirectoryRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListDirectoryRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListDirectoryRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListDirectoryRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListDirectoryRequestValidationError) ErrorName() string { + return "ListDirectoryRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListDirectoryRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListDirectoryRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListDirectoryRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListDirectoryRequestValidationError{} + +var _ListDirectoryRequest_Order_InLookup = map[string]struct{}{ + "asc": {}, + "desc": {}, +} + +var _ListDirectoryRequest_OrderBy_InLookup = map[string]struct{}{ + "id": {}, + "created_at": {}, + "updated_at": {}, +} + +// Validate checks the field values on ListDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListDirectoryReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListDirectoryReplyMultiError, or nil if none found. +func (m *ListDirectoryReply) ValidateAll() error { + return m.validate(true) +} + +func (m *ListDirectoryReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Total + + for idx, item := range m.GetList() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListDirectoryReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListDirectoryReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListDirectoryReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListDirectoryReplyMultiError(errors) + } + + return nil +} + +// ListDirectoryReplyMultiError is an error wrapping multiple validation errors +// returned by ListDirectoryReply.ValidateAll() if the designated constraints +// aren't met. +type ListDirectoryReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListDirectoryReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListDirectoryReplyMultiError) AllErrors() []error { return m } + +// ListDirectoryReplyValidationError is the validation error returned by +// ListDirectoryReply.Validate if the designated constraints aren't met. +type ListDirectoryReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListDirectoryReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListDirectoryReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListDirectoryReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListDirectoryReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListDirectoryReplyValidationError) ErrorName() string { + return "ListDirectoryReplyValidationError" +} + +// Error satisfies the builtin error interface +func (e ListDirectoryReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListDirectoryReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListDirectoryReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListDirectoryReplyValidationError{} + +// Validate checks the field values on CreateDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CreateDirectoryRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CreateDirectoryRequestMultiError, or nil if none found. +func (m *CreateDirectoryRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateDirectoryRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.GetParentId() <= 0 { + err := CreateDirectoryRequestValidationError{ + field: "ParentId", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetName()) < 1 { + err := CreateDirectoryRequestValidationError{ + field: "Name", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetAccept()) < 1 { + err := CreateDirectoryRequestValidationError{ + field: "Accept", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetMaxSize() < 1 { + err := CreateDirectoryRequestValidationError{ + field: "MaxSize", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return CreateDirectoryRequestMultiError(errors) + } + + return nil +} + +// CreateDirectoryRequestMultiError is an error wrapping multiple validation +// errors returned by CreateDirectoryRequest.ValidateAll() if the designated +// constraints aren't met. +type CreateDirectoryRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateDirectoryRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CreateDirectoryRequestMultiError) AllErrors() []error { return m } + +// CreateDirectoryRequestValidationError is the validation error returned by +// CreateDirectoryRequest.Validate if the designated constraints aren't met. +type CreateDirectoryRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateDirectoryRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateDirectoryRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateDirectoryRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateDirectoryRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateDirectoryRequestValidationError) ErrorName() string { + return "CreateDirectoryRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateDirectoryRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCreateDirectoryRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateDirectoryRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateDirectoryRequestValidationError{} + +// Validate checks the field values on CreateDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CreateDirectoryReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CreateDirectoryReplyMultiError, or nil if none found. +func (m *CreateDirectoryReply) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateDirectoryReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + if len(errors) > 0 { + return CreateDirectoryReplyMultiError(errors) + } + + return nil +} + +// CreateDirectoryReplyMultiError is an error wrapping multiple validation +// errors returned by CreateDirectoryReply.ValidateAll() if the designated +// constraints aren't met. +type CreateDirectoryReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateDirectoryReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CreateDirectoryReplyMultiError) AllErrors() []error { return m } + +// CreateDirectoryReplyValidationError is the validation error returned by +// CreateDirectoryReply.Validate if the designated constraints aren't met. +type CreateDirectoryReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateDirectoryReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateDirectoryReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateDirectoryReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateDirectoryReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateDirectoryReplyValidationError) ErrorName() string { + return "CreateDirectoryReplyValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateDirectoryReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCreateDirectoryReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateDirectoryReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateDirectoryReplyValidationError{} + +// Validate checks the field values on UpdateDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *UpdateDirectoryRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpdateDirectoryRequestMultiError, or nil if none found. +func (m *UpdateDirectoryRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateDirectoryRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.GetId() <= 0 { + err := UpdateDirectoryRequestValidationError{ + field: "Id", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetParentId() <= 0 { + err := UpdateDirectoryRequestValidationError{ + field: "ParentId", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetName()) < 1 { + err := UpdateDirectoryRequestValidationError{ + field: "Name", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetAccept()) < 1 { + err := UpdateDirectoryRequestValidationError{ + field: "Accept", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetMaxSize() < 1 { + err := UpdateDirectoryRequestValidationError{ + field: "MaxSize", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return UpdateDirectoryRequestMultiError(errors) + } + + return nil +} + +// UpdateDirectoryRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateDirectoryRequest.ValidateAll() if the designated +// constraints aren't met. +type UpdateDirectoryRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateDirectoryRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpdateDirectoryRequestMultiError) AllErrors() []error { return m } + +// UpdateDirectoryRequestValidationError is the validation error returned by +// UpdateDirectoryRequest.Validate if the designated constraints aren't met. +type UpdateDirectoryRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateDirectoryRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateDirectoryRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateDirectoryRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateDirectoryRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateDirectoryRequestValidationError) ErrorName() string { + return "UpdateDirectoryRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateDirectoryRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpdateDirectoryRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateDirectoryRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateDirectoryRequestValidationError{} + +// Validate checks the field values on UpdateDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *UpdateDirectoryReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpdateDirectoryReplyMultiError, or nil if none found. +func (m *UpdateDirectoryReply) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateDirectoryReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return UpdateDirectoryReplyMultiError(errors) + } + + return nil +} + +// UpdateDirectoryReplyMultiError is an error wrapping multiple validation +// errors returned by UpdateDirectoryReply.ValidateAll() if the designated +// constraints aren't met. +type UpdateDirectoryReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateDirectoryReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpdateDirectoryReplyMultiError) AllErrors() []error { return m } + +// UpdateDirectoryReplyValidationError is the validation error returned by +// UpdateDirectoryReply.Validate if the designated constraints aren't met. +type UpdateDirectoryReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateDirectoryReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateDirectoryReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateDirectoryReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateDirectoryReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateDirectoryReplyValidationError) ErrorName() string { + return "UpdateDirectoryReplyValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateDirectoryReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpdateDirectoryReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateDirectoryReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateDirectoryReplyValidationError{} + +// Validate checks the field values on DeleteDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *DeleteDirectoryRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteDirectoryRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DeleteDirectoryRequestMultiError, or nil if none found. +func (m *DeleteDirectoryRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteDirectoryRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if l := len(m.GetIds()); l < 1 || l > 50 { + err := DeleteDirectoryRequestValidationError{ + field: "Ids", + reason: "value must contain between 1 and 50 items, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + _DeleteDirectoryRequest_Ids_Unique := make(map[uint32]struct{}, len(m.GetIds())) + + for idx, item := range m.GetIds() { + _, _ = idx, item + + if _, exists := _DeleteDirectoryRequest_Ids_Unique[item]; exists { + err := DeleteDirectoryRequestValidationError{ + field: fmt.Sprintf("Ids[%v]", idx), + reason: "repeated value must contain unique items", + } + if !all { + return err + } + errors = append(errors, err) + } else { + _DeleteDirectoryRequest_Ids_Unique[item] = struct{}{} + } + + // no validation rules for Ids[idx] + } + + if len(errors) > 0 { + return DeleteDirectoryRequestMultiError(errors) + } + + return nil +} + +// DeleteDirectoryRequestMultiError is an error wrapping multiple validation +// errors returned by DeleteDirectoryRequest.ValidateAll() if the designated +// constraints aren't met. +type DeleteDirectoryRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteDirectoryRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteDirectoryRequestMultiError) AllErrors() []error { return m } + +// DeleteDirectoryRequestValidationError is the validation error returned by +// DeleteDirectoryRequest.Validate if the designated constraints aren't met. +type DeleteDirectoryRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeleteDirectoryRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeleteDirectoryRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeleteDirectoryRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeleteDirectoryRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeleteDirectoryRequestValidationError) ErrorName() string { + return "DeleteDirectoryRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e DeleteDirectoryRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeleteDirectoryRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeleteDirectoryRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeleteDirectoryRequestValidationError{} + +// Validate checks the field values on DeleteDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *DeleteDirectoryReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteDirectoryReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DeleteDirectoryReplyMultiError, or nil if none found. +func (m *DeleteDirectoryReply) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteDirectoryReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Total + + if len(errors) > 0 { + return DeleteDirectoryReplyMultiError(errors) + } + + return nil +} + +// DeleteDirectoryReplyMultiError is an error wrapping multiple validation +// errors returned by DeleteDirectoryReply.ValidateAll() if the designated +// constraints aren't met. +type DeleteDirectoryReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteDirectoryReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteDirectoryReplyMultiError) AllErrors() []error { return m } + +// DeleteDirectoryReplyValidationError is the validation error returned by +// DeleteDirectoryReply.Validate if the designated constraints aren't met. +type DeleteDirectoryReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeleteDirectoryReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeleteDirectoryReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeleteDirectoryReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeleteDirectoryReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeleteDirectoryReplyValidationError) ErrorName() string { + return "DeleteDirectoryReplyValidationError" +} + +// Error satisfies the builtin error interface +func (e DeleteDirectoryReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeleteDirectoryReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeleteDirectoryReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeleteDirectoryReplyValidationError{} + +// Validate checks the field values on ListDirectoryReply_Directory with the +// rules defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListDirectoryReply_Directory) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListDirectoryReply_Directory with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListDirectoryReply_DirectoryMultiError, or nil if none found. +func (m *ListDirectoryReply_Directory) ValidateAll() error { + return m.validate(true) +} + +func (m *ListDirectoryReply_Directory) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for ParentId + + // no validation rules for Name + + // no validation rules for Accept + + // no validation rules for MaxSize + + // no validation rules for CreatedAt + + // no validation rules for UpdatedAt + + for idx, item := range m.GetChildren() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListDirectoryReply_DirectoryValidationError{ + field: fmt.Sprintf("Children[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListDirectoryReply_DirectoryValidationError{ + field: fmt.Sprintf("Children[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListDirectoryReply_DirectoryValidationError{ + field: fmt.Sprintf("Children[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListDirectoryReply_DirectoryMultiError(errors) + } + + return nil +} + +// ListDirectoryReply_DirectoryMultiError is an error wrapping multiple +// validation errors returned by ListDirectoryReply_Directory.ValidateAll() if +// the designated constraints aren't met. +type ListDirectoryReply_DirectoryMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListDirectoryReply_DirectoryMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListDirectoryReply_DirectoryMultiError) AllErrors() []error { return m } + +// ListDirectoryReply_DirectoryValidationError is the validation error returned +// by ListDirectoryReply_Directory.Validate if the designated constraints +// aren't met. +type ListDirectoryReply_DirectoryValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListDirectoryReply_DirectoryValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListDirectoryReply_DirectoryValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListDirectoryReply_DirectoryValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListDirectoryReply_DirectoryValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListDirectoryReply_DirectoryValidationError) ErrorName() string { + return "ListDirectoryReply_DirectoryValidationError" +} + +// Error satisfies the builtin error interface +func (e ListDirectoryReply_DirectoryValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListDirectoryReply_Directory.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListDirectoryReply_DirectoryValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListDirectoryReply_DirectoryValidationError{} diff --git a/api/resource/directory/v1/resource_directory_service.pb.go b/api/resource/directory/v1/resource_directory_service.pb.go new file mode 100644 index 0000000..a501f70 --- /dev/null +++ b/api/resource/directory/v1/resource_directory_service.pb.go @@ -0,0 +1,151 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: api/resource/directory/resource_directory_service.proto + +package v1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_api_resource_directory_resource_directory_service_proto protoreflect.FileDescriptor + +var file_api_resource_directory_resource_directory_service_proto_rawDesc = []byte{ + 0x0a, 0x37, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x22, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x1a, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xea, 0x06, 0x0a, + 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0xa2, 0x01, 0x0a, 0x0c, 0x47, + 0x65, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x37, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x22, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, + 0xa7, 0x01, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x79, 0x12, 0x38, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0xae, 0x01, 0x0a, 0x0f, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x3a, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x22, 0x1a, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, + 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0xae, 0x01, 0x0a, 0x0f, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x3a, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x1a, + 0x1a, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0xab, 0x01, 0x0a, 0x0f, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, + 0x3a, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x2a, 0x1a, 0x2f, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x3c, 0x0a, 0x22, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x42, + 0x0b, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x56, 0x31, 0x50, 0x01, 0x5a, 0x07, + 0x2e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_api_resource_directory_resource_directory_service_proto_goTypes = []interface{}{ + (*GetDirectoryRequest)(nil), // 0: resource.api.resource.directory.v1.GetDirectoryRequest + (*ListDirectoryRequest)(nil), // 1: resource.api.resource.directory.v1.ListDirectoryRequest + (*CreateDirectoryRequest)(nil), // 2: resource.api.resource.directory.v1.CreateDirectoryRequest + (*UpdateDirectoryRequest)(nil), // 3: resource.api.resource.directory.v1.UpdateDirectoryRequest + (*DeleteDirectoryRequest)(nil), // 4: resource.api.resource.directory.v1.DeleteDirectoryRequest + (*GetDirectoryReply)(nil), // 5: resource.api.resource.directory.v1.GetDirectoryReply + (*ListDirectoryReply)(nil), // 6: resource.api.resource.directory.v1.ListDirectoryReply + (*CreateDirectoryReply)(nil), // 7: resource.api.resource.directory.v1.CreateDirectoryReply + (*UpdateDirectoryReply)(nil), // 8: resource.api.resource.directory.v1.UpdateDirectoryReply + (*DeleteDirectoryReply)(nil), // 9: resource.api.resource.directory.v1.DeleteDirectoryReply +} +var file_api_resource_directory_resource_directory_service_proto_depIdxs = []int32{ + 0, // 0: resource.api.resource.directory.v1.Directory.GetDirectory:input_type -> resource.api.resource.directory.v1.GetDirectoryRequest + 1, // 1: resource.api.resource.directory.v1.Directory.ListDirectory:input_type -> resource.api.resource.directory.v1.ListDirectoryRequest + 2, // 2: resource.api.resource.directory.v1.Directory.CreateDirectory:input_type -> resource.api.resource.directory.v1.CreateDirectoryRequest + 3, // 3: resource.api.resource.directory.v1.Directory.UpdateDirectory:input_type -> resource.api.resource.directory.v1.UpdateDirectoryRequest + 4, // 4: resource.api.resource.directory.v1.Directory.DeleteDirectory:input_type -> resource.api.resource.directory.v1.DeleteDirectoryRequest + 5, // 5: resource.api.resource.directory.v1.Directory.GetDirectory:output_type -> resource.api.resource.directory.v1.GetDirectoryReply + 6, // 6: resource.api.resource.directory.v1.Directory.ListDirectory:output_type -> resource.api.resource.directory.v1.ListDirectoryReply + 7, // 7: resource.api.resource.directory.v1.Directory.CreateDirectory:output_type -> resource.api.resource.directory.v1.CreateDirectoryReply + 8, // 8: resource.api.resource.directory.v1.Directory.UpdateDirectory:output_type -> resource.api.resource.directory.v1.UpdateDirectoryReply + 9, // 9: resource.api.resource.directory.v1.Directory.DeleteDirectory:output_type -> resource.api.resource.directory.v1.DeleteDirectoryReply + 5, // [5:10] is the sub-list for method output_type + 0, // [0:5] 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_api_resource_directory_resource_directory_service_proto_init() } +func file_api_resource_directory_resource_directory_service_proto_init() { + if File_api_resource_directory_resource_directory_service_proto != nil { + return + } + file_api_resource_directory_resource_directory_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_resource_directory_resource_directory_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_resource_directory_resource_directory_service_proto_goTypes, + DependencyIndexes: file_api_resource_directory_resource_directory_service_proto_depIdxs, + }.Build() + File_api_resource_directory_resource_directory_service_proto = out.File + file_api_resource_directory_resource_directory_service_proto_rawDesc = nil + file_api_resource_directory_resource_directory_service_proto_goTypes = nil + file_api_resource_directory_resource_directory_service_proto_depIdxs = nil +} diff --git a/api/resource/directory/v1/resource_directory_service_grpc.pb.go b/api/resource/directory/v1/resource_directory_service_grpc.pb.go new file mode 100644 index 0000000..f9594c4 --- /dev/null +++ b/api/resource/directory/v1/resource_directory_service_grpc.pb.go @@ -0,0 +1,267 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.4 +// source: api/resource/directory/resource_directory_service.proto + +package v1 + +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 ( + Directory_GetDirectory_FullMethodName = "/resource.api.resource.directory.v1.Directory/GetDirectory" + Directory_ListDirectory_FullMethodName = "/resource.api.resource.directory.v1.Directory/ListDirectory" + Directory_CreateDirectory_FullMethodName = "/resource.api.resource.directory.v1.Directory/CreateDirectory" + Directory_UpdateDirectory_FullMethodName = "/resource.api.resource.directory.v1.Directory/UpdateDirectory" + Directory_DeleteDirectory_FullMethodName = "/resource.api.resource.directory.v1.Directory/DeleteDirectory" +) + +// DirectoryClient is the client API for Directory 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 DirectoryClient interface { + // GetDirectory 获取指定的文件目录信息 + GetDirectory(ctx context.Context, in *GetDirectoryRequest, opts ...grpc.CallOption) (*GetDirectoryReply, error) + // ListDirectory 获取文件目录信息列表 + ListDirectory(ctx context.Context, in *ListDirectoryRequest, opts ...grpc.CallOption) (*ListDirectoryReply, error) + // CreateDirectory 创建文件目录信息 + CreateDirectory(ctx context.Context, in *CreateDirectoryRequest, opts ...grpc.CallOption) (*CreateDirectoryReply, error) + // UpdateDirectory 更新文件目录信息 + UpdateDirectory(ctx context.Context, in *UpdateDirectoryRequest, opts ...grpc.CallOption) (*UpdateDirectoryReply, error) + // DeleteDirectory 删除文件目录信息 + DeleteDirectory(ctx context.Context, in *DeleteDirectoryRequest, opts ...grpc.CallOption) (*DeleteDirectoryReply, error) +} + +type directoryClient struct { + cc grpc.ClientConnInterface +} + +func NewDirectoryClient(cc grpc.ClientConnInterface) DirectoryClient { + return &directoryClient{cc} +} + +func (c *directoryClient) GetDirectory(ctx context.Context, in *GetDirectoryRequest, opts ...grpc.CallOption) (*GetDirectoryReply, error) { + out := new(GetDirectoryReply) + err := c.cc.Invoke(ctx, Directory_GetDirectory_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *directoryClient) ListDirectory(ctx context.Context, in *ListDirectoryRequest, opts ...grpc.CallOption) (*ListDirectoryReply, error) { + out := new(ListDirectoryReply) + err := c.cc.Invoke(ctx, Directory_ListDirectory_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *directoryClient) CreateDirectory(ctx context.Context, in *CreateDirectoryRequest, opts ...grpc.CallOption) (*CreateDirectoryReply, error) { + out := new(CreateDirectoryReply) + err := c.cc.Invoke(ctx, Directory_CreateDirectory_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *directoryClient) UpdateDirectory(ctx context.Context, in *UpdateDirectoryRequest, opts ...grpc.CallOption) (*UpdateDirectoryReply, error) { + out := new(UpdateDirectoryReply) + err := c.cc.Invoke(ctx, Directory_UpdateDirectory_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *directoryClient) DeleteDirectory(ctx context.Context, in *DeleteDirectoryRequest, opts ...grpc.CallOption) (*DeleteDirectoryReply, error) { + out := new(DeleteDirectoryReply) + err := c.cc.Invoke(ctx, Directory_DeleteDirectory_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DirectoryServer is the server API for Directory service. +// All implementations must embed UnimplementedDirectoryServer +// for forward compatibility +type DirectoryServer interface { + // GetDirectory 获取指定的文件目录信息 + GetDirectory(context.Context, *GetDirectoryRequest) (*GetDirectoryReply, error) + // ListDirectory 获取文件目录信息列表 + ListDirectory(context.Context, *ListDirectoryRequest) (*ListDirectoryReply, error) + // CreateDirectory 创建文件目录信息 + CreateDirectory(context.Context, *CreateDirectoryRequest) (*CreateDirectoryReply, error) + // UpdateDirectory 更新文件目录信息 + UpdateDirectory(context.Context, *UpdateDirectoryRequest) (*UpdateDirectoryReply, error) + // DeleteDirectory 删除文件目录信息 + DeleteDirectory(context.Context, *DeleteDirectoryRequest) (*DeleteDirectoryReply, error) + mustEmbedUnimplementedDirectoryServer() +} + +// UnimplementedDirectoryServer must be embedded to have forward compatible implementations. +type UnimplementedDirectoryServer struct { +} + +func (UnimplementedDirectoryServer) GetDirectory(context.Context, *GetDirectoryRequest) (*GetDirectoryReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDirectory not implemented") +} +func (UnimplementedDirectoryServer) ListDirectory(context.Context, *ListDirectoryRequest) (*ListDirectoryReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListDirectory not implemented") +} +func (UnimplementedDirectoryServer) CreateDirectory(context.Context, *CreateDirectoryRequest) (*CreateDirectoryReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDirectory not implemented") +} +func (UnimplementedDirectoryServer) UpdateDirectory(context.Context, *UpdateDirectoryRequest) (*UpdateDirectoryReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateDirectory not implemented") +} +func (UnimplementedDirectoryServer) DeleteDirectory(context.Context, *DeleteDirectoryRequest) (*DeleteDirectoryReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteDirectory not implemented") +} +func (UnimplementedDirectoryServer) mustEmbedUnimplementedDirectoryServer() {} + +// UnsafeDirectoryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DirectoryServer will +// result in compilation errors. +type UnsafeDirectoryServer interface { + mustEmbedUnimplementedDirectoryServer() +} + +func RegisterDirectoryServer(s grpc.ServiceRegistrar, srv DirectoryServer) { + s.RegisterService(&Directory_ServiceDesc, srv) +} + +func _Directory_GetDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDirectoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DirectoryServer).GetDirectory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Directory_GetDirectory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DirectoryServer).GetDirectory(ctx, req.(*GetDirectoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Directory_ListDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListDirectoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DirectoryServer).ListDirectory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Directory_ListDirectory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DirectoryServer).ListDirectory(ctx, req.(*ListDirectoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Directory_CreateDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateDirectoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DirectoryServer).CreateDirectory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Directory_CreateDirectory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DirectoryServer).CreateDirectory(ctx, req.(*CreateDirectoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Directory_UpdateDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateDirectoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DirectoryServer).UpdateDirectory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Directory_UpdateDirectory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DirectoryServer).UpdateDirectory(ctx, req.(*UpdateDirectoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Directory_DeleteDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteDirectoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DirectoryServer).DeleteDirectory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Directory_DeleteDirectory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DirectoryServer).DeleteDirectory(ctx, req.(*DeleteDirectoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Directory_ServiceDesc is the grpc.ServiceDesc for Directory service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Directory_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "resource.api.resource.directory.v1.Directory", + HandlerType: (*DirectoryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetDirectory", + Handler: _Directory_GetDirectory_Handler, + }, + { + MethodName: "ListDirectory", + Handler: _Directory_ListDirectory_Handler, + }, + { + MethodName: "CreateDirectory", + Handler: _Directory_CreateDirectory_Handler, + }, + { + MethodName: "UpdateDirectory", + Handler: _Directory_UpdateDirectory_Handler, + }, + { + MethodName: "DeleteDirectory", + Handler: _Directory_DeleteDirectory_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/resource/directory/resource_directory_service.proto", +} diff --git a/api/resource/directory/v1/resource_directory_service_http.pb.go b/api/resource/directory/v1/resource_directory_service_http.pb.go new file mode 100644 index 0000000..4732f8c --- /dev/null +++ b/api/resource/directory/v1/resource_directory_service_http.pb.go @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-go-http. DO NOT EDIT. +// versions: +// - protoc-gen-go-http v2.7.3 +// - protoc v4.24.4 +// source: api/resource/directory/resource_directory_service.proto + +package v1 + +import ( + context "context" + http "github.com/go-kratos/kratos/v2/transport/http" + binding "github.com/go-kratos/kratos/v2/transport/http/binding" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the kratos package it is being compiled against. +var _ = new(context.Context) +var _ = binding.EncodeURL + +const _ = http.SupportPackageIsVersion1 + +const OperationDirectoryCreateDirectory = "/resource.api.resource.directory.v1.Directory/CreateDirectory" +const OperationDirectoryDeleteDirectory = "/resource.api.resource.directory.v1.Directory/DeleteDirectory" +const OperationDirectoryGetDirectory = "/resource.api.resource.directory.v1.Directory/GetDirectory" +const OperationDirectoryListDirectory = "/resource.api.resource.directory.v1.Directory/ListDirectory" +const OperationDirectoryUpdateDirectory = "/resource.api.resource.directory.v1.Directory/UpdateDirectory" + +type DirectoryHTTPServer interface { + // CreateDirectory CreateDirectory 创建文件目录信息 + CreateDirectory(context.Context, *CreateDirectoryRequest) (*CreateDirectoryReply, error) + // DeleteDirectory DeleteDirectory 删除文件目录信息 + DeleteDirectory(context.Context, *DeleteDirectoryRequest) (*DeleteDirectoryReply, error) + // GetDirectory GetDirectory 获取指定的文件目录信息 + GetDirectory(context.Context, *GetDirectoryRequest) (*GetDirectoryReply, error) + // ListDirectory ListDirectory 获取文件目录信息列表 + ListDirectory(context.Context, *ListDirectoryRequest) (*ListDirectoryReply, error) + // UpdateDirectory UpdateDirectory 更新文件目录信息 + UpdateDirectory(context.Context, *UpdateDirectoryRequest) (*UpdateDirectoryReply, error) +} + +func RegisterDirectoryHTTPServer(s *http.Server, srv DirectoryHTTPServer) { + r := s.Route("/") + r.GET("/resource/api/v1/directory", _Directory_GetDirectory0_HTTP_Handler(srv)) + r.GET("/resource/api/v1/directories", _Directory_ListDirectory0_HTTP_Handler(srv)) + r.POST("/resource/api/v1/directory", _Directory_CreateDirectory0_HTTP_Handler(srv)) + r.PUT("/resource/api/v1/directory", _Directory_UpdateDirectory0_HTTP_Handler(srv)) + r.DELETE("/resource/api/v1/directory", _Directory_DeleteDirectory0_HTTP_Handler(srv)) +} + +func _Directory_GetDirectory0_HTTP_Handler(srv DirectoryHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in GetDirectoryRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationDirectoryGetDirectory) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.GetDirectory(ctx, req.(*GetDirectoryRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*GetDirectoryReply) + return ctx.Result(200, reply) + } +} + +func _Directory_ListDirectory0_HTTP_Handler(srv DirectoryHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in ListDirectoryRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationDirectoryListDirectory) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.ListDirectory(ctx, req.(*ListDirectoryRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*ListDirectoryReply) + return ctx.Result(200, reply) + } +} + +func _Directory_CreateDirectory0_HTTP_Handler(srv DirectoryHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in CreateDirectoryRequest + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationDirectoryCreateDirectory) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.CreateDirectory(ctx, req.(*CreateDirectoryRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*CreateDirectoryReply) + return ctx.Result(200, reply) + } +} + +func _Directory_UpdateDirectory0_HTTP_Handler(srv DirectoryHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in UpdateDirectoryRequest + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationDirectoryUpdateDirectory) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.UpdateDirectory(ctx, req.(*UpdateDirectoryRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*UpdateDirectoryReply) + return ctx.Result(200, reply) + } +} + +func _Directory_DeleteDirectory0_HTTP_Handler(srv DirectoryHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in DeleteDirectoryRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationDirectoryDeleteDirectory) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.DeleteDirectory(ctx, req.(*DeleteDirectoryRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*DeleteDirectoryReply) + return ctx.Result(200, reply) + } +} + +type DirectoryHTTPClient interface { + CreateDirectory(ctx context.Context, req *CreateDirectoryRequest, opts ...http.CallOption) (rsp *CreateDirectoryReply, err error) + DeleteDirectory(ctx context.Context, req *DeleteDirectoryRequest, opts ...http.CallOption) (rsp *DeleteDirectoryReply, err error) + GetDirectory(ctx context.Context, req *GetDirectoryRequest, opts ...http.CallOption) (rsp *GetDirectoryReply, err error) + ListDirectory(ctx context.Context, req *ListDirectoryRequest, opts ...http.CallOption) (rsp *ListDirectoryReply, err error) + UpdateDirectory(ctx context.Context, req *UpdateDirectoryRequest, opts ...http.CallOption) (rsp *UpdateDirectoryReply, err error) +} + +type DirectoryHTTPClientImpl struct { + cc *http.Client +} + +func NewDirectoryHTTPClient(client *http.Client) DirectoryHTTPClient { + return &DirectoryHTTPClientImpl{client} +} + +func (c *DirectoryHTTPClientImpl) CreateDirectory(ctx context.Context, in *CreateDirectoryRequest, opts ...http.CallOption) (*CreateDirectoryReply, error) { + var out CreateDirectoryReply + pattern := "/resource/api/v1/directory" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationDirectoryCreateDirectory)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *DirectoryHTTPClientImpl) DeleteDirectory(ctx context.Context, in *DeleteDirectoryRequest, opts ...http.CallOption) (*DeleteDirectoryReply, error) { + var out DeleteDirectoryReply + pattern := "/resource/api/v1/directory" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationDirectoryDeleteDirectory)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *DirectoryHTTPClientImpl) GetDirectory(ctx context.Context, in *GetDirectoryRequest, opts ...http.CallOption) (*GetDirectoryReply, error) { + var out GetDirectoryReply + pattern := "/resource/api/v1/directory" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationDirectoryGetDirectory)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *DirectoryHTTPClientImpl) ListDirectory(ctx context.Context, in *ListDirectoryRequest, opts ...http.CallOption) (*ListDirectoryReply, error) { + var out ListDirectoryReply + pattern := "/resource/api/v1/directories" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationDirectoryListDirectory)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *DirectoryHTTPClientImpl) UpdateDirectory(ctx context.Context, in *UpdateDirectoryRequest, opts ...http.CallOption) (*UpdateDirectoryReply, error) { + var out UpdateDirectoryReply + pattern := "/resource/api/v1/directory" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationDirectoryUpdateDirectory)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "PUT", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} diff --git a/api/export/openapi.yaml b/api/resource/errors/openapi.yaml similarity index 100% rename from api/export/openapi.yaml rename to api/resource/errors/openapi.yaml diff --git a/api/resource/errors/resource_error_reason.pb.go b/api/resource/errors/resource_error_reason.pb.go new file mode 100644 index 0000000..534d03a --- /dev/null +++ b/api/resource/errors/resource_error_reason.pb.go @@ -0,0 +1,302 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: api/resource/errors/resource_error_reason.proto + +package errors + +import ( + _ "github.com/go-kratos/kratos/v2/errors" + 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) +) + +type ErrorReason int32 + +const ( + ErrorReason_ParamsError ErrorReason = 0 + ErrorReason_DatabaseError ErrorReason = 1 + ErrorReason_TransformError ErrorReason = 2 + ErrorReason_GetError ErrorReason = 3 + ErrorReason_ListError ErrorReason = 4 + ErrorReason_CreateError ErrorReason = 5 + ErrorReason_ImportError ErrorReason = 6 + ErrorReason_ExportError ErrorReason = 7 + ErrorReason_UpdateError ErrorReason = 8 + ErrorReason_DeleteError ErrorReason = 9 + ErrorReason_GetTrashError ErrorReason = 10 + ErrorReason_ListTrashError ErrorReason = 11 + ErrorReason_DeleteTrashError ErrorReason = 12 + ErrorReason_RevertTrashError ErrorReason = 13 + ErrorReason_NoSupportStoreError ErrorReason = 14 + ErrorReason_NoSupportFileTypeError ErrorReason = 15 + ErrorReason_VerifySignError ErrorReason = 16 + ErrorReason_SystemError ErrorReason = 17 + ErrorReason_ChunkUploadError ErrorReason = 18 + ErrorReason_StatusProgressError ErrorReason = 19 + ErrorReason_UploadFileError ErrorReason = 20 + ErrorReason_InitStoreError ErrorReason = 21 + ErrorReason_FileFormatError ErrorReason = 22 + ErrorReason_NotExistFileError ErrorReason = 23 + ErrorReason_AlreadyExistFileNameError ErrorReason = 24 + ErrorReason_AccessResourceError ErrorReason = 25 + ErrorReason_ExportFileNameDupError ErrorReason = 26 + ErrorReason_ExportTaskProcessError ErrorReason = 27 + ErrorReason_ResourceServerError ErrorReason = 28 + ErrorReason_ExceedMaxSizeError ErrorReason = 29 +) + +// Enum value maps for ErrorReason. +var ( + ErrorReason_name = map[int32]string{ + 0: "ParamsError", + 1: "DatabaseError", + 2: "TransformError", + 3: "GetError", + 4: "ListError", + 5: "CreateError", + 6: "ImportError", + 7: "ExportError", + 8: "UpdateError", + 9: "DeleteError", + 10: "GetTrashError", + 11: "ListTrashError", + 12: "DeleteTrashError", + 13: "RevertTrashError", + 14: "NoSupportStoreError", + 15: "NoSupportFileTypeError", + 16: "VerifySignError", + 17: "SystemError", + 18: "ChunkUploadError", + 19: "StatusProgressError", + 20: "UploadFileError", + 21: "InitStoreError", + 22: "FileFormatError", + 23: "NotExistFileError", + 24: "AlreadyExistFileNameError", + 25: "AccessResourceError", + 26: "ExportFileNameDupError", + 27: "ExportTaskProcessError", + 28: "ResourceServerError", + 29: "ExceedMaxSizeError", + } + ErrorReason_value = map[string]int32{ + "ParamsError": 0, + "DatabaseError": 1, + "TransformError": 2, + "GetError": 3, + "ListError": 4, + "CreateError": 5, + "ImportError": 6, + "ExportError": 7, + "UpdateError": 8, + "DeleteError": 9, + "GetTrashError": 10, + "ListTrashError": 11, + "DeleteTrashError": 12, + "RevertTrashError": 13, + "NoSupportStoreError": 14, + "NoSupportFileTypeError": 15, + "VerifySignError": 16, + "SystemError": 17, + "ChunkUploadError": 18, + "StatusProgressError": 19, + "UploadFileError": 20, + "InitStoreError": 21, + "FileFormatError": 22, + "NotExistFileError": 23, + "AlreadyExistFileNameError": 24, + "AccessResourceError": 25, + "ExportFileNameDupError": 26, + "ExportTaskProcessError": 27, + "ResourceServerError": 28, + "ExceedMaxSizeError": 29, + } +) + +func (x ErrorReason) Enum() *ErrorReason { + p := new(ErrorReason) + *p = x + return p +} + +func (x ErrorReason) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ErrorReason) Descriptor() protoreflect.EnumDescriptor { + return file_api_resource_errors_resource_error_reason_proto_enumTypes[0].Descriptor() +} + +func (ErrorReason) Type() protoreflect.EnumType { + return &file_api_resource_errors_resource_error_reason_proto_enumTypes[0] +} + +func (x ErrorReason) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ErrorReason.Descriptor instead. +func (ErrorReason) EnumDescriptor() ([]byte, []int) { + return file_api_resource_errors_resource_error_reason_proto_rawDescGZIP(), []int{0} +} + +var File_api_resource_errors_resource_error_reason_proto protoreflect.FileDescriptor + +var file_api_resource_errors_resource_error_reason_proto_rawDesc = []byte{ + 0x0a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x1a, 0x13, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x73, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a, 0x99, + 0x0b, 0x0a, 0x0b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x20, + 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x00, 0x1a, + 0x0f, 0xb2, 0x45, 0x0c, 0xe5, 0x8f, 0x82, 0xe6, 0x95, 0xb0, 0xe9, 0x94, 0x99, 0xe8, 0xaf, 0xaf, + 0x12, 0x25, 0x0a, 0x0d, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x10, 0x01, 0x1a, 0x12, 0xb2, 0x45, 0x0f, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xba, + 0x93, 0xe9, 0x94, 0x99, 0xe8, 0xaf, 0xaf, 0x12, 0x29, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, 0x1a, 0x15, 0xb2, 0x45, 0x12, + 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe8, 0xbd, 0xac, 0xe6, 0x8d, 0xa2, 0xe5, 0xa4, 0xb1, 0xe8, + 0xb4, 0xa5, 0x12, 0x23, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x03, + 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe8, 0x8e, 0xb7, 0xe5, 0x8f, 0x96, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, + 0xae, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x2a, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x10, 0x04, 0x1a, 0x1b, 0xb2, 0x45, 0x18, 0xe8, 0x8e, 0xb7, 0xe5, 0x8f, + 0x96, 0xe5, 0x88, 0x97, 0xe8, 0xa1, 0xa8, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, + 0xe8, 0xb4, 0xa5, 0x12, 0x26, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x10, 0x05, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe5, 0x88, 0x9b, 0xe5, 0xbb, 0xba, 0xe6, + 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x26, 0x0a, 0x0b, 0x49, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x06, 0x1a, 0x15, 0xb2, 0x45, + 0x12, 0xe5, 0xaf, 0xbc, 0xe5, 0x85, 0xa5, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, + 0xe8, 0xb4, 0xa5, 0x12, 0x26, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x10, 0x07, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe5, 0xaf, 0xbc, 0xe5, 0x87, 0xba, 0xe6, + 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x26, 0x0a, 0x0b, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x08, 0x1a, 0x15, 0xb2, 0x45, + 0x12, 0xe6, 0x9b, 0xb4, 0xe6, 0x96, 0xb0, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, + 0xe8, 0xb4, 0xa5, 0x12, 0x26, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x10, 0x09, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe5, 0x88, 0xa0, 0xe9, 0x99, 0xa4, 0xe6, + 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x31, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x54, 0x72, 0x61, 0x73, 0x68, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x0a, 0x1a, 0x1e, + 0xb2, 0x45, 0x1b, 0xe8, 0x8e, 0xb7, 0xe5, 0x8f, 0x96, 0xe5, 0x9b, 0x9e, 0xe6, 0x94, 0xb6, 0xe7, + 0xab, 0x99, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x38, + 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x61, 0x73, 0x68, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x10, 0x0b, 0x1a, 0x24, 0xb2, 0x45, 0x21, 0xe8, 0x8e, 0xb7, 0xe5, 0x8f, 0x96, 0xe5, 0x9b, 0x9e, + 0xe6, 0x94, 0xb6, 0xe7, 0xab, 0x99, 0xe5, 0x88, 0x97, 0xe8, 0xa1, 0xa8, 0xe6, 0x95, 0xb0, 0xe6, + 0x8d, 0xae, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x34, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x54, 0x72, 0x61, 0x73, 0x68, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x0c, 0x1a, 0x1e, + 0xb2, 0x45, 0x1b, 0xe5, 0x88, 0xa0, 0xe9, 0x99, 0xa4, 0xe5, 0x9b, 0x9e, 0xe6, 0x94, 0xb6, 0xe7, + 0xab, 0x99, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x34, + 0x0a, 0x10, 0x52, 0x65, 0x76, 0x65, 0x72, 0x74, 0x54, 0x72, 0x61, 0x73, 0x68, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x10, 0x0d, 0x1a, 0x1e, 0xb2, 0x45, 0x1b, 0xe8, 0xbf, 0x98, 0xe5, 0x8e, 0x9f, 0xe5, + 0x9b, 0x9e, 0xe6, 0x94, 0xb6, 0xe7, 0xab, 0x99, 0xe6, 0x95, 0xb0, 0xe6, 0x8d, 0xae, 0xe5, 0xa4, + 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x34, 0x0a, 0x13, 0x4e, 0x6f, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x0e, 0x1a, 0x1b, 0xb2, + 0x45, 0x18, 0xe4, 0xb8, 0x8d, 0xe6, 0x94, 0xaf, 0xe6, 0x8c, 0x81, 0xe7, 0x9a, 0x84, 0xe5, 0xad, + 0x98, 0xe5, 0x82, 0xa8, 0xe5, 0xbc, 0x95, 0xe6, 0x93, 0x8e, 0x12, 0x37, 0x0a, 0x16, 0x4e, 0x6f, + 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x10, 0x0f, 0x1a, 0x1b, 0xb2, 0x45, 0x18, 0xe4, 0xb8, 0x8d, 0xe6, 0x94, + 0xaf, 0xe6, 0x8c, 0x81, 0xe7, 0x9a, 0x84, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe7, 0xb1, 0xbb, + 0xe5, 0x9e, 0x8b, 0x12, 0x2a, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x53, 0x69, 0x67, + 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x10, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe7, 0xad, 0xbe, + 0xe5, 0x90, 0x8d, 0xe9, 0xaa, 0x8c, 0xe8, 0xaf, 0x81, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, + 0x20, 0x0a, 0x0b, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x11, + 0x1a, 0x0f, 0xb2, 0x45, 0x0c, 0xe7, 0xb3, 0xbb, 0xe7, 0xbb, 0x9f, 0xe9, 0x94, 0x99, 0xe8, 0xaf, + 0xaf, 0x12, 0x2b, 0x0a, 0x10, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x12, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe5, 0x88, 0x86, 0xe7, + 0x89, 0x87, 0xe4, 0xb8, 0x8a, 0xe4, 0xbc, 0xa0, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x2b, + 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x13, 0x1a, 0x12, 0xb2, 0x45, 0x0f, 0xe6, 0x96, 0x87, 0xe4, + 0xbb, 0xb6, 0xe4, 0xb8, 0x8a, 0xe4, 0xbc, 0xa0, 0xe4, 0xb8, 0xad, 0x12, 0x2a, 0x0a, 0x0f, 0x55, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x14, + 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe4, 0xb8, 0x8a, 0xe4, 0xbc, + 0xa0, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x32, 0x0a, 0x0e, 0x49, 0x6e, 0x69, 0x74, 0x53, + 0x74, 0x6f, 0x72, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x15, 0x1a, 0x1e, 0xb2, 0x45, 0x1b, + 0xe5, 0xad, 0x98, 0xe5, 0x82, 0xa8, 0xe5, 0xbc, 0x95, 0xe6, 0x93, 0x8e, 0xe5, 0x88, 0x9d, 0xe5, + 0xa7, 0x8b, 0xe5, 0x8c, 0x96, 0xe5, 0xa4, 0xb1, 0xe8, 0xb4, 0xa5, 0x12, 0x2a, 0x0a, 0x0f, 0x46, + 0x69, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x16, + 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe6, 0xa0, 0xbc, 0xe5, 0xbc, + 0x8f, 0xe9, 0x94, 0x99, 0xe8, 0xaf, 0xaf, 0x12, 0x29, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x45, 0x78, + 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x17, 0x1a, 0x12, + 0xb2, 0x45, 0x0f, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe4, 0xb8, 0x8d, 0xe5, 0xad, 0x98, 0xe5, + 0x9c, 0xa8, 0x12, 0x34, 0x0a, 0x19, 0x41, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x45, 0x78, 0x69, + 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, + 0x18, 0x1a, 0x15, 0xb2, 0x45, 0x12, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe5, 0x90, 0x8d, 0xe5, + 0xb7, 0xb2, 0xe5, 0xad, 0x98, 0xe5, 0x9c, 0xa8, 0x12, 0x34, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, + 0x19, 0x1a, 0x1b, 0xb2, 0x45, 0x18, 0xe8, 0xae, 0xbf, 0xe9, 0x97, 0xae, 0xe8, 0xb5, 0x84, 0xe6, + 0xba, 0x90, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe5, 0xbc, 0x82, 0xe5, 0xb8, 0xb8, 0x12, 0x3a, + 0x0a, 0x16, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x44, 0x75, 0x70, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x1a, 0x1a, 0x1e, 0xb2, 0x45, 0x1b, 0xe5, + 0xaf, 0xbc, 0xe5, 0x87, 0xba, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe9, 0x87, 0x8d, 0xe5, 0x91, + 0xbd, 0xe5, 0x90, 0x8d, 0xe9, 0x87, 0x8d, 0xe5, 0xa4, 0x8d, 0x12, 0x3a, 0x0a, 0x16, 0x45, 0x78, + 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x10, 0x1b, 0x1a, 0x1e, 0xb2, 0x45, 0x1b, 0xe5, 0xaf, 0xbc, 0xe5, 0x87, + 0xba, 0xe4, 0xbb, 0xbb, 0xe5, 0x8a, 0xa1, 0xe6, 0xad, 0xa3, 0xe5, 0x9c, 0xa8, 0xe8, 0xbf, 0x9b, + 0xe8, 0xa1, 0x8c, 0xe4, 0xb8, 0xad, 0x12, 0x2e, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x1c, 0x1a, + 0x15, 0xb2, 0x45, 0x12, 0xe8, 0xb5, 0x84, 0xe6, 0xba, 0x90, 0xe6, 0x9c, 0x8d, 0xe5, 0x8a, 0xa1, + 0xe5, 0xbc, 0x82, 0xe5, 0xb8, 0xb8, 0x12, 0x3c, 0x0a, 0x12, 0x45, 0x78, 0x63, 0x65, 0x65, 0x64, + 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x1d, 0x1a, 0x24, + 0xb2, 0x45, 0x21, 0xe8, 0xb6, 0x85, 0xe8, 0xbf, 0x87, 0xe5, 0x85, 0x81, 0xe8, 0xae, 0xb8, 0xe4, + 0xb8, 0x8a, 0xe4, 0xbc, 0xa0, 0xe7, 0x9a, 0x84, 0xe6, 0x96, 0x87, 0xe4, 0xbb, 0xb6, 0xe5, 0xa4, + 0xa7, 0xe5, 0xb0, 0x8f, 0x1a, 0x04, 0xa0, 0x45, 0xf4, 0x03, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, + 0x3b, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_resource_errors_resource_error_reason_proto_rawDescOnce sync.Once + file_api_resource_errors_resource_error_reason_proto_rawDescData = file_api_resource_errors_resource_error_reason_proto_rawDesc +) + +func file_api_resource_errors_resource_error_reason_proto_rawDescGZIP() []byte { + file_api_resource_errors_resource_error_reason_proto_rawDescOnce.Do(func() { + file_api_resource_errors_resource_error_reason_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_resource_errors_resource_error_reason_proto_rawDescData) + }) + return file_api_resource_errors_resource_error_reason_proto_rawDescData +} + +var file_api_resource_errors_resource_error_reason_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_resource_errors_resource_error_reason_proto_goTypes = []interface{}{ + (ErrorReason)(0), // 0: errors.ErrorReason +} +var file_api_resource_errors_resource_error_reason_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_api_resource_errors_resource_error_reason_proto_init() } +func file_api_resource_errors_resource_error_reason_proto_init() { + if File_api_resource_errors_resource_error_reason_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_resource_errors_resource_error_reason_proto_rawDesc, + NumEnums: 1, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_resource_errors_resource_error_reason_proto_goTypes, + DependencyIndexes: file_api_resource_errors_resource_error_reason_proto_depIdxs, + EnumInfos: file_api_resource_errors_resource_error_reason_proto_enumTypes, + }.Build() + File_api_resource_errors_resource_error_reason_proto = out.File + file_api_resource_errors_resource_error_reason_proto_rawDesc = nil + file_api_resource_errors_resource_error_reason_proto_goTypes = nil + file_api_resource_errors_resource_error_reason_proto_depIdxs = nil +} diff --git a/api/resource/errors/resource_error_reason.proto b/api/resource/errors/resource_error_reason.proto new file mode 100755 index 0000000..e126137 --- /dev/null +++ b/api/resource/errors/resource_error_reason.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package errors; + +import "errors/errors.proto"; +option go_package = "./;errors"; + +enum ErrorReason { + // 设置缺省错误码 + option (errors.default_code) = 500; + + ParamsError = 0[(errors.message)="参数错误"]; + DatabaseError = 1[(errors.message)="数据库错误"]; + TransformError = 2[(errors.message)="数据转换失败"]; + GetError = 3[(errors.message)="获取数据失败"]; + ListError = 4[(errors.message)="获取列表数据失败"]; + CreateError = 5[(errors.message)="创建数据失败"]; + ImportError = 6[(errors.message)="导入数据失败"]; + ExportError = 7[(errors.message)="导出数据失败"]; + UpdateError = 8[(errors.message)="更新数据失败"]; + DeleteError = 9[(errors.message)="删除数据失败"]; + GetTrashError = 10[(errors.message)="获取回收站数据失败"]; + ListTrashError = 11[(errors.message)="获取回收站列表数据失败"]; + DeleteTrashError = 12[(errors.message)="删除回收站数据失败"]; + RevertTrashError = 13[(errors.message)="还原回收站数据失败"]; + NoSupportStoreError = 14[(errors.message)="不支持的存储引擎"]; + NoSupportFileTypeError = 15[(errors.message)="不支持的文件类型"]; + VerifySignError = 16[(errors.message)="签名验证失败"]; + SystemError = 17[(errors.message)="系统错误"]; + ChunkUploadError = 18[(errors.message)="分片上传失败"]; + StatusProgressError = 19[(errors.message)="文件上传中"]; + UploadFileError = 20[(errors.message)="文件上传失败"]; + InitStoreError = 21[(errors.message)="存储引擎初始化失败"]; + FileFormatError = 22[(errors.message)="文件格式错误"]; + NotExistFileError = 23[(errors.message)="文件不存在"]; + AlreadyExistFileNameError = 24[(errors.message)="文件名已存在"]; + AccessResourceError = 25[(errors.message)="访问资源文件异常"]; + ExportFileNameDupError = 26[(errors.message)="导出文件重命名重复"]; + ExportTaskProcessError = 27[(errors.message)="导出任务正在进行中"]; + ResourceServerError = 28[(errors.message)="资源服务异常"]; + ExceedMaxSizeError = 29[(errors.message)="超过允许上传的文件大小"]; +} \ No newline at end of file diff --git a/api/resource/errors/resource_error_reason_errors.pb.go b/api/resource/errors/resource_error_reason_errors.pb.go new file mode 100644 index 0000000..ee01b73 --- /dev/null +++ b/api/resource/errors/resource_error_reason_errors.pb.go @@ -0,0 +1,612 @@ +// Code generated by protoc-gen-go-errors. DO NOT EDIT. + +package errors + +import ( + fmt "fmt" + errors "github.com/go-kratos/kratos/v2/errors" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the kratos package it is being compiled against. +const _ = errors.SupportPackageIsVersion1 + +func IsParamsError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ParamsError.String() && e.Code == 500 +} + +func ParamsError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ParamsError.String(), "参数错误") + case 1: + return errors.New(500, ErrorReason_ParamsError.String(), "参数错误:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ParamsError.String(), "参数错误:"+msg) + } +} + +func IsDatabaseError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_DatabaseError.String() && e.Code == 500 +} + +func DatabaseError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_DatabaseError.String(), "数据库错误") + case 1: + return errors.New(500, ErrorReason_DatabaseError.String(), "数据库错误:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_DatabaseError.String(), "数据库错误:"+msg) + } +} + +func IsTransformError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_TransformError.String() && e.Code == 500 +} + +func TransformError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_TransformError.String(), "数据转换失败") + case 1: + return errors.New(500, ErrorReason_TransformError.String(), "数据转换失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_TransformError.String(), "数据转换失败:"+msg) + } +} + +func IsGetError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_GetError.String() && e.Code == 500 +} + +func GetError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_GetError.String(), "获取数据失败") + case 1: + return errors.New(500, ErrorReason_GetError.String(), "获取数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_GetError.String(), "获取数据失败:"+msg) + } +} + +func IsListError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ListError.String() && e.Code == 500 +} + +func ListError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ListError.String(), "获取列表数据失败") + case 1: + return errors.New(500, ErrorReason_ListError.String(), "获取列表数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ListError.String(), "获取列表数据失败:"+msg) + } +} + +func IsCreateError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_CreateError.String() && e.Code == 500 +} + +func CreateError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_CreateError.String(), "创建数据失败") + case 1: + return errors.New(500, ErrorReason_CreateError.String(), "创建数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_CreateError.String(), "创建数据失败:"+msg) + } +} + +func IsImportError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ImportError.String() && e.Code == 500 +} + +func ImportError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ImportError.String(), "导入数据失败") + case 1: + return errors.New(500, ErrorReason_ImportError.String(), "导入数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ImportError.String(), "导入数据失败:"+msg) + } +} + +func IsExportError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ExportError.String() && e.Code == 500 +} + +func ExportError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ExportError.String(), "导出数据失败") + case 1: + return errors.New(500, ErrorReason_ExportError.String(), "导出数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ExportError.String(), "导出数据失败:"+msg) + } +} + +func IsUpdateError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_UpdateError.String() && e.Code == 500 +} + +func UpdateError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_UpdateError.String(), "更新数据失败") + case 1: + return errors.New(500, ErrorReason_UpdateError.String(), "更新数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_UpdateError.String(), "更新数据失败:"+msg) + } +} + +func IsDeleteError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_DeleteError.String() && e.Code == 500 +} + +func DeleteError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_DeleteError.String(), "删除数据失败") + case 1: + return errors.New(500, ErrorReason_DeleteError.String(), "删除数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_DeleteError.String(), "删除数据失败:"+msg) + } +} + +func IsGetTrashError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_GetTrashError.String() && e.Code == 500 +} + +func GetTrashError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_GetTrashError.String(), "获取回收站数据失败") + case 1: + return errors.New(500, ErrorReason_GetTrashError.String(), "获取回收站数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_GetTrashError.String(), "获取回收站数据失败:"+msg) + } +} + +func IsListTrashError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ListTrashError.String() && e.Code == 500 +} + +func ListTrashError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ListTrashError.String(), "获取回收站列表数据失败") + case 1: + return errors.New(500, ErrorReason_ListTrashError.String(), "获取回收站列表数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ListTrashError.String(), "获取回收站列表数据失败:"+msg) + } +} + +func IsDeleteTrashError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_DeleteTrashError.String() && e.Code == 500 +} + +func DeleteTrashError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_DeleteTrashError.String(), "删除回收站数据失败") + case 1: + return errors.New(500, ErrorReason_DeleteTrashError.String(), "删除回收站数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_DeleteTrashError.String(), "删除回收站数据失败:"+msg) + } +} + +func IsRevertTrashError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_RevertTrashError.String() && e.Code == 500 +} + +func RevertTrashError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_RevertTrashError.String(), "还原回收站数据失败") + case 1: + return errors.New(500, ErrorReason_RevertTrashError.String(), "还原回收站数据失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_RevertTrashError.String(), "还原回收站数据失败:"+msg) + } +} + +func IsNoSupportStoreError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_NoSupportStoreError.String() && e.Code == 500 +} + +func NoSupportStoreError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_NoSupportStoreError.String(), "不支持的存储引擎") + case 1: + return errors.New(500, ErrorReason_NoSupportStoreError.String(), "不支持的存储引擎:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_NoSupportStoreError.String(), "不支持的存储引擎:"+msg) + } +} + +func IsNoSupportFileTypeError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_NoSupportFileTypeError.String() && e.Code == 500 +} + +func NoSupportFileTypeError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_NoSupportFileTypeError.String(), "不支持的文件类型") + case 1: + return errors.New(500, ErrorReason_NoSupportFileTypeError.String(), "不支持的文件类型:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_NoSupportFileTypeError.String(), "不支持的文件类型:"+msg) + } +} + +func IsVerifySignError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_VerifySignError.String() && e.Code == 500 +} + +func VerifySignError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_VerifySignError.String(), "签名验证失败") + case 1: + return errors.New(500, ErrorReason_VerifySignError.String(), "签名验证失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_VerifySignError.String(), "签名验证失败:"+msg) + } +} + +func IsSystemError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_SystemError.String() && e.Code == 500 +} + +func SystemError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_SystemError.String(), "系统错误") + case 1: + return errors.New(500, ErrorReason_SystemError.String(), "系统错误:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_SystemError.String(), "系统错误:"+msg) + } +} + +func IsChunkUploadError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ChunkUploadError.String() && e.Code == 500 +} + +func ChunkUploadError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ChunkUploadError.String(), "分片上传失败") + case 1: + return errors.New(500, ErrorReason_ChunkUploadError.String(), "分片上传失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ChunkUploadError.String(), "分片上传失败:"+msg) + } +} + +func IsStatusProgressError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_StatusProgressError.String() && e.Code == 500 +} + +func StatusProgressError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_StatusProgressError.String(), "文件上传中") + case 1: + return errors.New(500, ErrorReason_StatusProgressError.String(), "文件上传中:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_StatusProgressError.String(), "文件上传中:"+msg) + } +} + +func IsUploadFileError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_UploadFileError.String() && e.Code == 500 +} + +func UploadFileError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_UploadFileError.String(), "文件上传失败") + case 1: + return errors.New(500, ErrorReason_UploadFileError.String(), "文件上传失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_UploadFileError.String(), "文件上传失败:"+msg) + } +} + +func IsInitStoreError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_InitStoreError.String() && e.Code == 500 +} + +func InitStoreError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_InitStoreError.String(), "存储引擎初始化失败") + case 1: + return errors.New(500, ErrorReason_InitStoreError.String(), "存储引擎初始化失败:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_InitStoreError.String(), "存储引擎初始化失败:"+msg) + } +} + +func IsFileFormatError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_FileFormatError.String() && e.Code == 500 +} + +func FileFormatError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_FileFormatError.String(), "文件格式错误") + case 1: + return errors.New(500, ErrorReason_FileFormatError.String(), "文件格式错误:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_FileFormatError.String(), "文件格式错误:"+msg) + } +} + +func IsNotExistFileError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_NotExistFileError.String() && e.Code == 500 +} + +func NotExistFileError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_NotExistFileError.String(), "文件不存在") + case 1: + return errors.New(500, ErrorReason_NotExistFileError.String(), "文件不存在:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_NotExistFileError.String(), "文件不存在:"+msg) + } +} + +func IsAlreadyExistFileNameError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_AlreadyExistFileNameError.String() && e.Code == 500 +} + +func AlreadyExistFileNameError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_AlreadyExistFileNameError.String(), "文件名已存在") + case 1: + return errors.New(500, ErrorReason_AlreadyExistFileNameError.String(), "文件名已存在:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_AlreadyExistFileNameError.String(), "文件名已存在:"+msg) + } +} + +func IsAccessResourceError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_AccessResourceError.String() && e.Code == 500 +} + +func AccessResourceError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_AccessResourceError.String(), "访问资源文件异常") + case 1: + return errors.New(500, ErrorReason_AccessResourceError.String(), "访问资源文件异常:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_AccessResourceError.String(), "访问资源文件异常:"+msg) + } +} + +func IsExportFileNameDupError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ExportFileNameDupError.String() && e.Code == 500 +} + +func ExportFileNameDupError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ExportFileNameDupError.String(), "导出文件重命名重复") + case 1: + return errors.New(500, ErrorReason_ExportFileNameDupError.String(), "导出文件重命名重复:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ExportFileNameDupError.String(), "导出文件重命名重复:"+msg) + } +} + +func IsExportTaskProcessError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ExportTaskProcessError.String() && e.Code == 500 +} + +func ExportTaskProcessError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ExportTaskProcessError.String(), "导出任务正在进行中") + case 1: + return errors.New(500, ErrorReason_ExportTaskProcessError.String(), "导出任务正在进行中:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ExportTaskProcessError.String(), "导出任务正在进行中:"+msg) + } +} + +func IsResourceServerError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ResourceServerError.String() && e.Code == 500 +} + +func ResourceServerError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ResourceServerError.String(), "资源服务异常") + case 1: + return errors.New(500, ErrorReason_ResourceServerError.String(), "资源服务异常:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ResourceServerError.String(), "资源服务异常:"+msg) + } +} + +func IsExceedMaxSizeError(err error) bool { + if err == nil { + return false + } + e := errors.FromError(err) + return e.Reason == ErrorReason_ExceedMaxSizeError.String() && e.Code == 500 +} + +func ExceedMaxSizeError(args ...any) *errors.Error { + switch len(args) { + case 0: + return errors.New(500, ErrorReason_ExceedMaxSizeError.String(), "超过允许上传的文件大小") + case 1: + return errors.New(500, ErrorReason_ExceedMaxSizeError.String(), "超过允许上传的文件大小:"+fmt.Sprint(args[0])) + default: + msg := fmt.Sprintf(fmt.Sprint(args[0]), args[1:]...) + return errors.New(500, ErrorReason_ExceedMaxSizeError.String(), "超过允许上传的文件大小:"+msg) + } +} diff --git a/api/resource/export/openapi.yaml b/api/resource/export/openapi.yaml new file mode 100644 index 0000000..5f1f44f --- /dev/null +++ b/api/resource/export/openapi.yaml @@ -0,0 +1,208 @@ +# Generated with protoc-gen-openapi +# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi + +openapi: 3.0.3 +info: + title: Export API + version: 0.0.1 +paths: + /resource/api/v1/export: + post: + tags: + - Export + description: CreateExport 创建导出信息 + operationId: Export_CreateExport + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateExportRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateExportReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + delete: + tags: + - Export + description: DeleteExport 删除导出信息 + operationId: Export_DeleteExport + parameters: + - name: ids + in: query + schema: + type: array + items: + type: integer + format: uint32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteExportReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /resource/api/v1/exports: + get: + tags: + - Export + description: ListExport 获取导出信息列表 + operationId: Export_ListExport + parameters: + - name: page + in: query + schema: + type: integer + format: uint32 + - name: pageSize + in: query + schema: + type: integer + format: uint32 + - name: order + in: query + schema: + type: string + - name: orderBy + in: query + schema: + type: string + - name: userId + in: query + schema: + type: integer + format: uint32 + - name: departmentId + in: query + schema: + type: integer + format: uint32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListExportReply' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' +components: + schemas: + CreateExportReply: + type: object + properties: + id: + type: integer + format: uint32 + CreateExportRequest: + type: object + properties: + userId: + type: integer + format: uint32 + departmentId: + type: integer + format: uint32 + scene: + type: string + name: + type: string + reason: + type: string + DeleteExportReply: + type: object + properties: + total: + type: integer + format: uint32 + GoogleProtobufAny: + type: object + properties: + '@type': + type: string + description: The type of the serialized message. + additionalProperties: true + description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. + ListExportReply: + type: object + properties: + total: + type: integer + format: uint32 + list: + type: array + items: + $ref: '#/components/schemas/ListExportReply_Export' + ListExportReply_Export: + type: object + properties: + id: + type: integer + format: uint32 + userId: + type: integer + format: uint32 + departmentId: + type: integer + format: uint32 + scene: + type: string + name: + type: string + size: + type: integer + format: uint32 + sha: + type: string + src: + type: string + status: + type: string + reason: + type: string + expiredAt: + type: integer + format: uint32 + createdAt: + type: integer + format: uint32 + updatedAt: + type: integer + format: uint32 + Status: + type: object + properties: + code: + type: integer + description: The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + format: int32 + message: + type: string + description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + details: + type: array + items: + $ref: '#/components/schemas/GoogleProtobufAny' + description: A list of messages that carry the error details. There is a common set of message types for APIs to use. + description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).' +tags: + - name: Export diff --git a/api/resource/export/resource_export.proto b/api/resource/export/resource_export.proto new file mode 100755 index 0000000..2ff0cd5 --- /dev/null +++ b/api/resource/export/resource_export.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package resource.api.resource.export.v1; + +option go_package = "./v1;v1"; +option java_multiple_files = true; +option java_package = "resource.api.resource.export.v1"; +option java_outer_classname = "ExportV1"; + +import "validate/validate.proto"; + +message ListExportRequest { + uint32 page = 1[(validate.rules).uint32 = {gt: 0}]; + uint32 pageSize = 2[(validate.rules).uint32 = {gt: 0,lte:50}]; + optional string order = 3[(validate.rules).string = {in: ["asc","desc"]}]; + optional string orderBy = 4[(validate.rules).string = {in: ["id","created_at","updated_at"]}]; + optional uint32 userId = 5; + optional uint32 departmentId = 6; +} + +message ListExportReply { + message Export { + uint32 id = 1; + uint32 userId = 2; + uint32 departmentId = 3; + string scene = 4; + string name = 5; + uint32 size = 6; + optional string sha = 7; + optional string src = 8; + string status = 9; + optional string reason = 10; + uint32 expiredAt = 11; + uint32 createdAt = 12; + uint32 updatedAt = 13; + } + + uint32 total = 1; + repeated Export list = 2; +} + +message CreateExportRequest { + uint32 userId = 1[(validate.rules).uint32 = {gt: 0}]; + uint32 departmentId = 2[(validate.rules).uint32 = {gt: 0}]; + string scene = 3[(validate.rules).string = {min_len: 1}]; + string name = 4[(validate.rules).string = {min_len: 1}]; + optional string reason = 5; +} + +message CreateExportReply { + uint32 id = 1; +} + +message DeleteExportRequest { + repeated uint32 ids = 1[(validate.rules).repeated = {min_items: 1, unique:true, max_items:50}]; +} + +message DeleteExportReply { + uint32 total = 1; +} + diff --git a/api/resource/export/resource_export_service.proto b/api/resource/export/resource_export_service.proto new file mode 100755 index 0000000..a1c1b16 --- /dev/null +++ b/api/resource/export/resource_export_service.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +package resource.api.resource.export.v1; + +option go_package = "./v1;v1"; +option java_multiple_files = true; +option java_package = "resource.api.resource.export.v1"; +option java_outer_classname = "ExportV1"; + +import "api/resource/export/resource_export.proto"; +import "google/api/annotations.proto"; + +service Export{ + + // ListExport 获取导出信息列表 + rpc ListExport (ListExportRequest) returns (ListExportReply) { + option (google.api.http) = { + get: "/resource/api/v1/exports", + }; + } + + // CreateExport 创建导出信息 + rpc CreateExport (CreateExportRequest) returns (CreateExportReply) { + option (google.api.http) = { + post: "/resource/api/v1/export", + body: "*" + }; + } + + // DeleteExport 删除导出信息 + rpc DeleteExport (DeleteExportRequest) returns (DeleteExportReply) { + option (google.api.http) = { + delete: "/resource/api/v1/export", + }; + } + +} \ No newline at end of file diff --git a/api/resource/export/v1/resource_export.pb.go b/api/resource/export/v1/resource_export.pb.go new file mode 100644 index 0000000..3473d01 --- /dev/null +++ b/api/resource/export/v1/resource_export.pb.go @@ -0,0 +1,759 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: api/resource/export/resource_export.proto + +package v1 + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + 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) +) + +type ListExportRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page uint32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + Order *string `protobuf:"bytes,3,opt,name=order,proto3,oneof" json:"order,omitempty"` + OrderBy *string `protobuf:"bytes,4,opt,name=orderBy,proto3,oneof" json:"orderBy,omitempty"` + UserId *uint32 `protobuf:"varint,5,opt,name=userId,proto3,oneof" json:"userId,omitempty"` + DepartmentId *uint32 `protobuf:"varint,6,opt,name=departmentId,proto3,oneof" json:"departmentId,omitempty"` +} + +func (x *ListExportRequest) Reset() { + *x = ListExportRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_export_resource_export_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListExportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListExportRequest) ProtoMessage() {} + +func (x *ListExportRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_export_resource_export_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 ListExportRequest.ProtoReflect.Descriptor instead. +func (*ListExportRequest) Descriptor() ([]byte, []int) { + return file_api_resource_export_resource_export_proto_rawDescGZIP(), []int{0} +} + +func (x *ListExportRequest) GetPage() uint32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListExportRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListExportRequest) GetOrder() string { + if x != nil && x.Order != nil { + return *x.Order + } + return "" +} + +func (x *ListExportRequest) GetOrderBy() string { + if x != nil && x.OrderBy != nil { + return *x.OrderBy + } + return "" +} + +func (x *ListExportRequest) GetUserId() uint32 { + if x != nil && x.UserId != nil { + return *x.UserId + } + return 0 +} + +func (x *ListExportRequest) GetDepartmentId() uint32 { + if x != nil && x.DepartmentId != nil { + return *x.DepartmentId + } + return 0 +} + +type ListExportReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*ListExportReply_Export `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListExportReply) Reset() { + *x = ListExportReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_export_resource_export_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListExportReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListExportReply) ProtoMessage() {} + +func (x *ListExportReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_export_resource_export_proto_msgTypes[1] + 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 ListExportReply.ProtoReflect.Descriptor instead. +func (*ListExportReply) Descriptor() ([]byte, []int) { + return file_api_resource_export_resource_export_proto_rawDescGZIP(), []int{1} +} + +func (x *ListExportReply) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListExportReply) GetList() []*ListExportReply_Export { + if x != nil { + return x.List + } + return nil +} + +type CreateExportRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId uint32 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + DepartmentId uint32 `protobuf:"varint,2,opt,name=departmentId,proto3" json:"departmentId,omitempty"` + Scene string `protobuf:"bytes,3,opt,name=scene,proto3" json:"scene,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Reason *string `protobuf:"bytes,5,opt,name=reason,proto3,oneof" json:"reason,omitempty"` +} + +func (x *CreateExportRequest) Reset() { + *x = CreateExportRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_export_resource_export_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateExportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateExportRequest) ProtoMessage() {} + +func (x *CreateExportRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_export_resource_export_proto_msgTypes[2] + 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 CreateExportRequest.ProtoReflect.Descriptor instead. +func (*CreateExportRequest) Descriptor() ([]byte, []int) { + return file_api_resource_export_resource_export_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateExportRequest) GetUserId() uint32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *CreateExportRequest) GetDepartmentId() uint32 { + if x != nil { + return x.DepartmentId + } + return 0 +} + +func (x *CreateExportRequest) GetScene() string { + if x != nil { + return x.Scene + } + return "" +} + +func (x *CreateExportRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateExportRequest) GetReason() string { + if x != nil && x.Reason != nil { + return *x.Reason + } + return "" +} + +type CreateExportReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CreateExportReply) Reset() { + *x = CreateExportReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_export_resource_export_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateExportReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateExportReply) ProtoMessage() {} + +func (x *CreateExportReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_export_resource_export_proto_msgTypes[3] + 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 CreateExportReply.ProtoReflect.Descriptor instead. +func (*CreateExportReply) Descriptor() ([]byte, []int) { + return file_api_resource_export_resource_export_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateExportReply) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +type DeleteExportRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ids []uint32 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"` +} + +func (x *DeleteExportRequest) Reset() { + *x = DeleteExportRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_export_resource_export_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteExportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteExportRequest) ProtoMessage() {} + +func (x *DeleteExportRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_export_resource_export_proto_msgTypes[4] + 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 DeleteExportRequest.ProtoReflect.Descriptor instead. +func (*DeleteExportRequest) Descriptor() ([]byte, []int) { + return file_api_resource_export_resource_export_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteExportRequest) GetIds() []uint32 { + if x != nil { + return x.Ids + } + return nil +} + +type DeleteExportReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` +} + +func (x *DeleteExportReply) Reset() { + *x = DeleteExportReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_export_resource_export_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteExportReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteExportReply) ProtoMessage() {} + +func (x *DeleteExportReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_export_resource_export_proto_msgTypes[5] + 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 DeleteExportReply.ProtoReflect.Descriptor instead. +func (*DeleteExportReply) Descriptor() ([]byte, []int) { + return file_api_resource_export_resource_export_proto_rawDescGZIP(), []int{5} +} + +func (x *DeleteExportReply) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +type ListExportReply_Export struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + UserId uint32 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"` + DepartmentId uint32 `protobuf:"varint,3,opt,name=departmentId,proto3" json:"departmentId,omitempty"` + Scene string `protobuf:"bytes,4,opt,name=scene,proto3" json:"scene,omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + Size uint32 `protobuf:"varint,6,opt,name=size,proto3" json:"size,omitempty"` + Sha *string `protobuf:"bytes,7,opt,name=sha,proto3,oneof" json:"sha,omitempty"` + Src *string `protobuf:"bytes,8,opt,name=src,proto3,oneof" json:"src,omitempty"` + Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"` + Reason *string `protobuf:"bytes,10,opt,name=reason,proto3,oneof" json:"reason,omitempty"` + ExpiredAt uint32 `protobuf:"varint,11,opt,name=expiredAt,proto3" json:"expiredAt,omitempty"` + CreatedAt uint32 `protobuf:"varint,12,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt uint32 `protobuf:"varint,13,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` +} + +func (x *ListExportReply_Export) Reset() { + *x = ListExportReply_Export{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_export_resource_export_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListExportReply_Export) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListExportReply_Export) ProtoMessage() {} + +func (x *ListExportReply_Export) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_export_resource_export_proto_msgTypes[6] + 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 ListExportReply_Export.ProtoReflect.Descriptor instead. +func (*ListExportReply_Export) Descriptor() ([]byte, []int) { + return file_api_resource_export_resource_export_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *ListExportReply_Export) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ListExportReply_Export) GetUserId() uint32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ListExportReply_Export) GetDepartmentId() uint32 { + if x != nil { + return x.DepartmentId + } + return 0 +} + +func (x *ListExportReply_Export) GetScene() string { + if x != nil { + return x.Scene + } + return "" +} + +func (x *ListExportReply_Export) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ListExportReply_Export) GetSize() uint32 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *ListExportReply_Export) GetSha() string { + if x != nil && x.Sha != nil { + return *x.Sha + } + return "" +} + +func (x *ListExportReply_Export) GetSrc() string { + if x != nil && x.Src != nil { + return *x.Src + } + return "" +} + +func (x *ListExportReply_Export) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *ListExportReply_Export) GetReason() string { + if x != nil && x.Reason != nil { + return *x.Reason + } + return "" +} + +func (x *ListExportReply_Export) GetExpiredAt() uint32 { + if x != nil { + return x.ExpiredAt + } + return 0 +} + +func (x *ListExportReply_Export) GetCreatedAt() uint32 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ListExportReply_Export) GetUpdatedAt() uint32 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +var File_api_resource_export_resource_export_proto protoreflect.FileDescriptor + +var file_api_resource_export_resource_export_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x65, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x78, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x70, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, + 0x20, 0x00, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x2a, + 0x04, 0x18, 0x32, 0x20, 0x00, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x2b, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10, + 0xfa, 0x42, 0x0d, 0x72, 0x0b, 0x52, 0x03, 0x61, 0x73, 0x63, 0x52, 0x04, 0x64, 0x65, 0x73, 0x63, + 0x48, 0x00, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x40, 0x0a, 0x07, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xfa, + 0x42, 0x1e, 0x72, 0x1c, 0x52, 0x02, 0x69, 0x64, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x48, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x0c, 0x64, + 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x03, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x49, + 0x64, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x0a, + 0x0a, 0x08, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, + 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0xe1, 0x03, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x45, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x12, 0x4b, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x1a, 0xea, 0x02, + 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, + 0x6e, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x12, 0x15, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x03, 0x73, 0x68, 0x61, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x73, 0x72, 0x63, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x03, 0x73, 0x72, 0x63, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, + 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, + 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, + 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, + 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, + 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, + 0x06, 0x0a, 0x04, 0x5f, 0x73, 0x68, 0x61, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x73, 0x72, 0x63, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0xc7, 0x01, 0x0a, 0x13, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, + 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, + 0x20, 0x00, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x1d, 0x0a, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x12, + 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x06, + 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, + 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x72, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x23, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x78, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x35, 0x0a, 0x13, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1e, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x0c, 0xfa, + 0x42, 0x09, 0x92, 0x01, 0x06, 0x08, 0x01, 0x10, 0x32, 0x18, 0x01, 0x52, 0x03, 0x69, 0x64, 0x73, + 0x22, 0x29, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x36, 0x0a, 0x1f, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x08, + 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x56, 0x31, 0x50, 0x01, 0x5a, 0x07, 0x2e, 0x2f, 0x76, 0x31, + 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_resource_export_resource_export_proto_rawDescOnce sync.Once + file_api_resource_export_resource_export_proto_rawDescData = file_api_resource_export_resource_export_proto_rawDesc +) + +func file_api_resource_export_resource_export_proto_rawDescGZIP() []byte { + file_api_resource_export_resource_export_proto_rawDescOnce.Do(func() { + file_api_resource_export_resource_export_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_resource_export_resource_export_proto_rawDescData) + }) + return file_api_resource_export_resource_export_proto_rawDescData +} + +var file_api_resource_export_resource_export_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_api_resource_export_resource_export_proto_goTypes = []interface{}{ + (*ListExportRequest)(nil), // 0: resource.api.resource.export.v1.ListExportRequest + (*ListExportReply)(nil), // 1: resource.api.resource.export.v1.ListExportReply + (*CreateExportRequest)(nil), // 2: resource.api.resource.export.v1.CreateExportRequest + (*CreateExportReply)(nil), // 3: resource.api.resource.export.v1.CreateExportReply + (*DeleteExportRequest)(nil), // 4: resource.api.resource.export.v1.DeleteExportRequest + (*DeleteExportReply)(nil), // 5: resource.api.resource.export.v1.DeleteExportReply + (*ListExportReply_Export)(nil), // 6: resource.api.resource.export.v1.ListExportReply.Export +} +var file_api_resource_export_resource_export_proto_depIdxs = []int32{ + 6, // 0: resource.api.resource.export.v1.ListExportReply.list:type_name -> resource.api.resource.export.v1.ListExportReply.Export + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_resource_export_resource_export_proto_init() } +func file_api_resource_export_resource_export_proto_init() { + if File_api_resource_export_resource_export_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_resource_export_resource_export_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListExportRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_export_resource_export_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListExportReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_export_resource_export_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateExportRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_export_resource_export_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateExportReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_export_resource_export_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteExportRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_export_resource_export_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteExportReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_export_resource_export_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListExportReply_Export); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_api_resource_export_resource_export_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_api_resource_export_resource_export_proto_msgTypes[2].OneofWrappers = []interface{}{} + file_api_resource_export_resource_export_proto_msgTypes[6].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_resource_export_resource_export_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_resource_export_resource_export_proto_goTypes, + DependencyIndexes: file_api_resource_export_resource_export_proto_depIdxs, + MessageInfos: file_api_resource_export_resource_export_proto_msgTypes, + }.Build() + File_api_resource_export_resource_export_proto = out.File + file_api_resource_export_resource_export_proto_rawDesc = nil + file_api_resource_export_resource_export_proto_goTypes = nil + file_api_resource_export_resource_export_proto_depIdxs = nil +} diff --git a/api/resource/export/v1/resource_export.pb.validate.go b/api/resource/export/v1/resource_export.pb.validate.go new file mode 100644 index 0000000..c58fcbe --- /dev/null +++ b/api/resource/export/v1/resource_export.pb.validate.go @@ -0,0 +1,971 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: api/resource/export/resource_export.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on ListExportRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ListExportRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListExportRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListExportRequestMultiError, or nil if none found. +func (m *ListExportRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListExportRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.GetPage() <= 0 { + err := ListExportRequestValidationError{ + field: "Page", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetPageSize(); val <= 0 || val > 50 { + err := ListExportRequestValidationError{ + field: "PageSize", + reason: "value must be inside range (0, 50]", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.Order != nil { + + if _, ok := _ListExportRequest_Order_InLookup[m.GetOrder()]; !ok { + err := ListExportRequestValidationError{ + field: "Order", + reason: "value must be in list [asc desc]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.OrderBy != nil { + + if _, ok := _ListExportRequest_OrderBy_InLookup[m.GetOrderBy()]; !ok { + err := ListExportRequestValidationError{ + field: "OrderBy", + reason: "value must be in list [id created_at updated_at]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.UserId != nil { + // no validation rules for UserId + } + + if m.DepartmentId != nil { + // no validation rules for DepartmentId + } + + if len(errors) > 0 { + return ListExportRequestMultiError(errors) + } + + return nil +} + +// ListExportRequestMultiError is an error wrapping multiple validation errors +// returned by ListExportRequest.ValidateAll() if the designated constraints +// aren't met. +type ListExportRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListExportRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListExportRequestMultiError) AllErrors() []error { return m } + +// ListExportRequestValidationError is the validation error returned by +// ListExportRequest.Validate if the designated constraints aren't met. +type ListExportRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListExportRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListExportRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListExportRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListExportRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListExportRequestValidationError) ErrorName() string { + return "ListExportRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListExportRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListExportRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListExportRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListExportRequestValidationError{} + +var _ListExportRequest_Order_InLookup = map[string]struct{}{ + "asc": {}, + "desc": {}, +} + +var _ListExportRequest_OrderBy_InLookup = map[string]struct{}{ + "id": {}, + "created_at": {}, + "updated_at": {}, +} + +// Validate checks the field values on ListExportReply with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ListExportReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListExportReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListExportReplyMultiError, or nil if none found. +func (m *ListExportReply) ValidateAll() error { + return m.validate(true) +} + +func (m *ListExportReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Total + + for idx, item := range m.GetList() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListExportReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListExportReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListExportReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListExportReplyMultiError(errors) + } + + return nil +} + +// ListExportReplyMultiError is an error wrapping multiple validation errors +// returned by ListExportReply.ValidateAll() if the designated constraints +// aren't met. +type ListExportReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListExportReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListExportReplyMultiError) AllErrors() []error { return m } + +// ListExportReplyValidationError is the validation error returned by +// ListExportReply.Validate if the designated constraints aren't met. +type ListExportReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListExportReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListExportReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListExportReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListExportReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListExportReplyValidationError) ErrorName() string { return "ListExportReplyValidationError" } + +// Error satisfies the builtin error interface +func (e ListExportReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListExportReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListExportReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListExportReplyValidationError{} + +// Validate checks the field values on CreateExportRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CreateExportRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateExportRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CreateExportRequestMultiError, or nil if none found. +func (m *CreateExportRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateExportRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.GetUserId() <= 0 { + err := CreateExportRequestValidationError{ + field: "UserId", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetDepartmentId() <= 0 { + err := CreateExportRequestValidationError{ + field: "DepartmentId", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetScene()) < 1 { + err := CreateExportRequestValidationError{ + field: "Scene", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetName()) < 1 { + err := CreateExportRequestValidationError{ + field: "Name", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.Reason != nil { + // no validation rules for Reason + } + + if len(errors) > 0 { + return CreateExportRequestMultiError(errors) + } + + return nil +} + +// CreateExportRequestMultiError is an error wrapping multiple validation +// errors returned by CreateExportRequest.ValidateAll() if the designated +// constraints aren't met. +type CreateExportRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateExportRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CreateExportRequestMultiError) AllErrors() []error { return m } + +// CreateExportRequestValidationError is the validation error returned by +// CreateExportRequest.Validate if the designated constraints aren't met. +type CreateExportRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateExportRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateExportRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateExportRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateExportRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateExportRequestValidationError) ErrorName() string { + return "CreateExportRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateExportRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCreateExportRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateExportRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateExportRequestValidationError{} + +// Validate checks the field values on CreateExportReply with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *CreateExportReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CreateExportReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CreateExportReplyMultiError, or nil if none found. +func (m *CreateExportReply) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateExportReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + if len(errors) > 0 { + return CreateExportReplyMultiError(errors) + } + + return nil +} + +// CreateExportReplyMultiError is an error wrapping multiple validation errors +// returned by CreateExportReply.ValidateAll() if the designated constraints +// aren't met. +type CreateExportReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateExportReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CreateExportReplyMultiError) AllErrors() []error { return m } + +// CreateExportReplyValidationError is the validation error returned by +// CreateExportReply.Validate if the designated constraints aren't met. +type CreateExportReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateExportReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateExportReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateExportReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateExportReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateExportReplyValidationError) ErrorName() string { + return "CreateExportReplyValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateExportReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCreateExportReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateExportReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateExportReplyValidationError{} + +// Validate checks the field values on DeleteExportRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *DeleteExportRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteExportRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DeleteExportRequestMultiError, or nil if none found. +func (m *DeleteExportRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteExportRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if l := len(m.GetIds()); l < 1 || l > 50 { + err := DeleteExportRequestValidationError{ + field: "Ids", + reason: "value must contain between 1 and 50 items, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + _DeleteExportRequest_Ids_Unique := make(map[uint32]struct{}, len(m.GetIds())) + + for idx, item := range m.GetIds() { + _, _ = idx, item + + if _, exists := _DeleteExportRequest_Ids_Unique[item]; exists { + err := DeleteExportRequestValidationError{ + field: fmt.Sprintf("Ids[%v]", idx), + reason: "repeated value must contain unique items", + } + if !all { + return err + } + errors = append(errors, err) + } else { + _DeleteExportRequest_Ids_Unique[item] = struct{}{} + } + + // no validation rules for Ids[idx] + } + + if len(errors) > 0 { + return DeleteExportRequestMultiError(errors) + } + + return nil +} + +// DeleteExportRequestMultiError is an error wrapping multiple validation +// errors returned by DeleteExportRequest.ValidateAll() if the designated +// constraints aren't met. +type DeleteExportRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteExportRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteExportRequestMultiError) AllErrors() []error { return m } + +// DeleteExportRequestValidationError is the validation error returned by +// DeleteExportRequest.Validate if the designated constraints aren't met. +type DeleteExportRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeleteExportRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeleteExportRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeleteExportRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeleteExportRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeleteExportRequestValidationError) ErrorName() string { + return "DeleteExportRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e DeleteExportRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeleteExportRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeleteExportRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeleteExportRequestValidationError{} + +// Validate checks the field values on DeleteExportReply with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *DeleteExportReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteExportReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DeleteExportReplyMultiError, or nil if none found. +func (m *DeleteExportReply) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteExportReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Total + + if len(errors) > 0 { + return DeleteExportReplyMultiError(errors) + } + + return nil +} + +// DeleteExportReplyMultiError is an error wrapping multiple validation errors +// returned by DeleteExportReply.ValidateAll() if the designated constraints +// aren't met. +type DeleteExportReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteExportReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteExportReplyMultiError) AllErrors() []error { return m } + +// DeleteExportReplyValidationError is the validation error returned by +// DeleteExportReply.Validate if the designated constraints aren't met. +type DeleteExportReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeleteExportReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeleteExportReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeleteExportReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeleteExportReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeleteExportReplyValidationError) ErrorName() string { + return "DeleteExportReplyValidationError" +} + +// Error satisfies the builtin error interface +func (e DeleteExportReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeleteExportReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeleteExportReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeleteExportReplyValidationError{} + +// Validate checks the field values on ListExportReply_Export with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListExportReply_Export) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListExportReply_Export with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListExportReply_ExportMultiError, or nil if none found. +func (m *ListExportReply_Export) ValidateAll() error { + return m.validate(true) +} + +func (m *ListExportReply_Export) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for UserId + + // no validation rules for DepartmentId + + // no validation rules for Scene + + // no validation rules for Name + + // no validation rules for Size + + // no validation rules for Status + + // no validation rules for ExpiredAt + + // no validation rules for CreatedAt + + // no validation rules for UpdatedAt + + if m.Sha != nil { + // no validation rules for Sha + } + + if m.Src != nil { + // no validation rules for Src + } + + if m.Reason != nil { + // no validation rules for Reason + } + + if len(errors) > 0 { + return ListExportReply_ExportMultiError(errors) + } + + return nil +} + +// ListExportReply_ExportMultiError is an error wrapping multiple validation +// errors returned by ListExportReply_Export.ValidateAll() if the designated +// constraints aren't met. +type ListExportReply_ExportMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListExportReply_ExportMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListExportReply_ExportMultiError) AllErrors() []error { return m } + +// ListExportReply_ExportValidationError is the validation error returned by +// ListExportReply_Export.Validate if the designated constraints aren't met. +type ListExportReply_ExportValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListExportReply_ExportValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListExportReply_ExportValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListExportReply_ExportValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListExportReply_ExportValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListExportReply_ExportValidationError) ErrorName() string { + return "ListExportReply_ExportValidationError" +} + +// Error satisfies the builtin error interface +func (e ListExportReply_ExportValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListExportReply_Export.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListExportReply_ExportValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListExportReply_ExportValidationError{} diff --git a/api/resource/export/v1/resource_export_service.pb.go b/api/resource/export/v1/resource_export_service.pb.go new file mode 100644 index 0000000..e6e6b69 --- /dev/null +++ b/api/resource/export/v1/resource_export_service.pb.go @@ -0,0 +1,117 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: api/resource/export/resource_export_service.proto + +package v1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_api_resource_export_resource_export_service_proto protoreflect.FileDescriptor + +var file_api_resource_export_resource_export_service_proto_rawDesc = []byte{ + 0x0a, 0x31, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x65, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, + 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x29, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xda, 0x03, + 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x94, 0x01, 0x0a, 0x0a, 0x4c, 0x69, 0x73, + 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x32, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, + 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x78, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x20, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, + 0x9c, 0x01, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x12, 0x34, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x65, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x1c, 0x3a, 0x01, 0x2a, 0x22, 0x17, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x99, + 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, + 0x34, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, + 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x78, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x19, 0x2a, 0x17, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x36, 0x0a, 0x1f, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x45, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x56, 0x31, 0x50, 0x01, 0x5a, 0x07, 0x2e, 0x2f, 0x76, 0x31, 0x3b, + 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_api_resource_export_resource_export_service_proto_goTypes = []interface{}{ + (*ListExportRequest)(nil), // 0: resource.api.resource.export.v1.ListExportRequest + (*CreateExportRequest)(nil), // 1: resource.api.resource.export.v1.CreateExportRequest + (*DeleteExportRequest)(nil), // 2: resource.api.resource.export.v1.DeleteExportRequest + (*ListExportReply)(nil), // 3: resource.api.resource.export.v1.ListExportReply + (*CreateExportReply)(nil), // 4: resource.api.resource.export.v1.CreateExportReply + (*DeleteExportReply)(nil), // 5: resource.api.resource.export.v1.DeleteExportReply +} +var file_api_resource_export_resource_export_service_proto_depIdxs = []int32{ + 0, // 0: resource.api.resource.export.v1.Export.ListExport:input_type -> resource.api.resource.export.v1.ListExportRequest + 1, // 1: resource.api.resource.export.v1.Export.CreateExport:input_type -> resource.api.resource.export.v1.CreateExportRequest + 2, // 2: resource.api.resource.export.v1.Export.DeleteExport:input_type -> resource.api.resource.export.v1.DeleteExportRequest + 3, // 3: resource.api.resource.export.v1.Export.ListExport:output_type -> resource.api.resource.export.v1.ListExportReply + 4, // 4: resource.api.resource.export.v1.Export.CreateExport:output_type -> resource.api.resource.export.v1.CreateExportReply + 5, // 5: resource.api.resource.export.v1.Export.DeleteExport:output_type -> resource.api.resource.export.v1.DeleteExportReply + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] 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_api_resource_export_resource_export_service_proto_init() } +func file_api_resource_export_resource_export_service_proto_init() { + if File_api_resource_export_resource_export_service_proto != nil { + return + } + file_api_resource_export_resource_export_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_resource_export_resource_export_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_resource_export_resource_export_service_proto_goTypes, + DependencyIndexes: file_api_resource_export_resource_export_service_proto_depIdxs, + }.Build() + File_api_resource_export_resource_export_service_proto = out.File + file_api_resource_export_resource_export_service_proto_rawDesc = nil + file_api_resource_export_resource_export_service_proto_goTypes = nil + file_api_resource_export_resource_export_service_proto_depIdxs = nil +} diff --git a/api/resource/export/v1/resource_export_service_grpc.pb.go b/api/resource/export/v1/resource_export_service_grpc.pb.go new file mode 100644 index 0000000..4147199 --- /dev/null +++ b/api/resource/export/v1/resource_export_service_grpc.pb.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.4 +// source: api/resource/export/resource_export_service.proto + +package v1 + +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 ( + Export_ListExport_FullMethodName = "/resource.api.resource.export.v1.Export/ListExport" + Export_CreateExport_FullMethodName = "/resource.api.resource.export.v1.Export/CreateExport" + Export_DeleteExport_FullMethodName = "/resource.api.resource.export.v1.Export/DeleteExport" +) + +// ExportClient is the client API for Export 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 ExportClient interface { + // ListExport 获取导出信息列表 + ListExport(ctx context.Context, in *ListExportRequest, opts ...grpc.CallOption) (*ListExportReply, error) + // CreateExport 创建导出信息 + CreateExport(ctx context.Context, in *CreateExportRequest, opts ...grpc.CallOption) (*CreateExportReply, error) + // DeleteExport 删除导出信息 + DeleteExport(ctx context.Context, in *DeleteExportRequest, opts ...grpc.CallOption) (*DeleteExportReply, error) +} + +type exportClient struct { + cc grpc.ClientConnInterface +} + +func NewExportClient(cc grpc.ClientConnInterface) ExportClient { + return &exportClient{cc} +} + +func (c *exportClient) ListExport(ctx context.Context, in *ListExportRequest, opts ...grpc.CallOption) (*ListExportReply, error) { + out := new(ListExportReply) + err := c.cc.Invoke(ctx, Export_ListExport_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *exportClient) CreateExport(ctx context.Context, in *CreateExportRequest, opts ...grpc.CallOption) (*CreateExportReply, error) { + out := new(CreateExportReply) + err := c.cc.Invoke(ctx, Export_CreateExport_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *exportClient) DeleteExport(ctx context.Context, in *DeleteExportRequest, opts ...grpc.CallOption) (*DeleteExportReply, error) { + out := new(DeleteExportReply) + err := c.cc.Invoke(ctx, Export_DeleteExport_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ExportServer is the server API for Export service. +// All implementations must embed UnimplementedExportServer +// for forward compatibility +type ExportServer interface { + // ListExport 获取导出信息列表 + ListExport(context.Context, *ListExportRequest) (*ListExportReply, error) + // CreateExport 创建导出信息 + CreateExport(context.Context, *CreateExportRequest) (*CreateExportReply, error) + // DeleteExport 删除导出信息 + DeleteExport(context.Context, *DeleteExportRequest) (*DeleteExportReply, error) + mustEmbedUnimplementedExportServer() +} + +// UnimplementedExportServer must be embedded to have forward compatible implementations. +type UnimplementedExportServer struct { +} + +func (UnimplementedExportServer) ListExport(context.Context, *ListExportRequest) (*ListExportReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListExport not implemented") +} +func (UnimplementedExportServer) CreateExport(context.Context, *CreateExportRequest) (*CreateExportReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateExport not implemented") +} +func (UnimplementedExportServer) DeleteExport(context.Context, *DeleteExportRequest) (*DeleteExportReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteExport not implemented") +} +func (UnimplementedExportServer) mustEmbedUnimplementedExportServer() {} + +// UnsafeExportServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ExportServer will +// result in compilation errors. +type UnsafeExportServer interface { + mustEmbedUnimplementedExportServer() +} + +func RegisterExportServer(s grpc.ServiceRegistrar, srv ExportServer) { + s.RegisterService(&Export_ServiceDesc, srv) +} + +func _Export_ListExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListExportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExportServer).ListExport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Export_ListExport_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExportServer).ListExport(ctx, req.(*ListExportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Export_CreateExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateExportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExportServer).CreateExport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Export_CreateExport_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExportServer).CreateExport(ctx, req.(*CreateExportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Export_DeleteExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteExportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ExportServer).DeleteExport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Export_DeleteExport_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ExportServer).DeleteExport(ctx, req.(*DeleteExportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Export_ServiceDesc is the grpc.ServiceDesc for Export service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Export_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "resource.api.resource.export.v1.Export", + HandlerType: (*ExportServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListExport", + Handler: _Export_ListExport_Handler, + }, + { + MethodName: "CreateExport", + Handler: _Export_CreateExport_Handler, + }, + { + MethodName: "DeleteExport", + Handler: _Export_DeleteExport_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/resource/export/resource_export_service.proto", +} diff --git a/api/resource/export/v1/resource_export_service_http.pb.go b/api/resource/export/v1/resource_export_service_http.pb.go new file mode 100644 index 0000000..dfb4fa3 --- /dev/null +++ b/api/resource/export/v1/resource_export_service_http.pb.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-go-http. DO NOT EDIT. +// versions: +// - protoc-gen-go-http v2.7.3 +// - protoc v4.24.4 +// source: api/resource/export/resource_export_service.proto + +package v1 + +import ( + context "context" + http "github.com/go-kratos/kratos/v2/transport/http" + binding "github.com/go-kratos/kratos/v2/transport/http/binding" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the kratos package it is being compiled against. +var _ = new(context.Context) +var _ = binding.EncodeURL + +const _ = http.SupportPackageIsVersion1 + +const OperationExportCreateExport = "/resource.api.resource.export.v1.Export/CreateExport" +const OperationExportDeleteExport = "/resource.api.resource.export.v1.Export/DeleteExport" +const OperationExportListExport = "/resource.api.resource.export.v1.Export/ListExport" + +type ExportHTTPServer interface { + // CreateExport CreateExport 创建导出信息 + CreateExport(context.Context, *CreateExportRequest) (*CreateExportReply, error) + // DeleteExport DeleteExport 删除导出信息 + DeleteExport(context.Context, *DeleteExportRequest) (*DeleteExportReply, error) + // ListExport ListExport 获取导出信息列表 + ListExport(context.Context, *ListExportRequest) (*ListExportReply, error) +} + +func RegisterExportHTTPServer(s *http.Server, srv ExportHTTPServer) { + r := s.Route("/") + r.GET("/resource/api/v1/exports", _Export_ListExport0_HTTP_Handler(srv)) + r.POST("/resource/api/v1/export", _Export_CreateExport0_HTTP_Handler(srv)) + r.DELETE("/resource/api/v1/export", _Export_DeleteExport0_HTTP_Handler(srv)) +} + +func _Export_ListExport0_HTTP_Handler(srv ExportHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in ListExportRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationExportListExport) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.ListExport(ctx, req.(*ListExportRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*ListExportReply) + return ctx.Result(200, reply) + } +} + +func _Export_CreateExport0_HTTP_Handler(srv ExportHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in CreateExportRequest + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationExportCreateExport) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.CreateExport(ctx, req.(*CreateExportRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*CreateExportReply) + return ctx.Result(200, reply) + } +} + +func _Export_DeleteExport0_HTTP_Handler(srv ExportHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in DeleteExportRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationExportDeleteExport) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.DeleteExport(ctx, req.(*DeleteExportRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*DeleteExportReply) + return ctx.Result(200, reply) + } +} + +type ExportHTTPClient interface { + CreateExport(ctx context.Context, req *CreateExportRequest, opts ...http.CallOption) (rsp *CreateExportReply, err error) + DeleteExport(ctx context.Context, req *DeleteExportRequest, opts ...http.CallOption) (rsp *DeleteExportReply, err error) + ListExport(ctx context.Context, req *ListExportRequest, opts ...http.CallOption) (rsp *ListExportReply, err error) +} + +type ExportHTTPClientImpl struct { + cc *http.Client +} + +func NewExportHTTPClient(client *http.Client) ExportHTTPClient { + return &ExportHTTPClientImpl{client} +} + +func (c *ExportHTTPClientImpl) CreateExport(ctx context.Context, in *CreateExportRequest, opts ...http.CallOption) (*CreateExportReply, error) { + var out CreateExportReply + pattern := "/resource/api/v1/export" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationExportCreateExport)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *ExportHTTPClientImpl) DeleteExport(ctx context.Context, in *DeleteExportRequest, opts ...http.CallOption) (*DeleteExportReply, error) { + var out DeleteExportReply + pattern := "/resource/api/v1/export" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationExportDeleteExport)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *ExportHTTPClientImpl) ListExport(ctx context.Context, in *ListExportRequest, opts ...http.CallOption) (*ListExportReply, error) { + var out ListExportReply + pattern := "/resource/api/v1/exports" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationExportListExport)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} diff --git a/api/file/openapi.yaml b/api/resource/file/openapi.yaml similarity index 100% rename from api/file/openapi.yaml rename to api/resource/file/openapi.yaml diff --git a/api/resource/file/resource_file.proto b/api/resource/file/resource_file.proto new file mode 100755 index 0000000..b79dd26 --- /dev/null +++ b/api/resource/file/resource_file.proto @@ -0,0 +1,126 @@ +syntax = "proto3"; + +package resource.api.resource.file.v1; + +option go_package = "./v1;v1"; +option java_multiple_files = true; +option java_package = "resource.api.resource.file.v1"; +option java_outer_classname = "FileV1"; + +import "validate/validate.proto"; + +message StaticFileRequest{ + string src = 1[(validate.rules).string = {min_len:1}]; + string expire = 2[(validate.rules).string = {min_len:1}]; + string sign = 3[(validate.rules).string = {min_len:1}]; + uint32 width = 4; + uint32 height = 5; + string mode = 6; + bool download = 7; + string saveName = 8; +} + +message StaticFileReply{ + bytes data = 1; + string mime = 2; +} + +message GetFileRequest { + optional uint32 id = 1[(validate.rules).uint32 = {gt: 0}]; + optional string sha = 2[(validate.rules).string = {min_len: 1}]; +} + +message GetFileReply { + uint32 id = 1; + uint32 directoryId = 2; + string name = 3; + string type = 4; + uint32 size = 5; + string sha = 6; + string src = 7; + string url = 8; + string status = 9; + string uploadId = 10; + uint32 chunkCount = 11; + uint32 createdAt = 12; + uint32 updatedAt = 13; +} + +message ListFileRequest { + uint32 page = 1[(validate.rules).uint32 = {gt: 0}]; + uint32 pageSize = 2[(validate.rules).uint32 = {gt: 0,lte:50}]; + optional string order = 3[(validate.rules).string = {in: ["asc","desc"]}]; + optional string orderBy = 4[(validate.rules).string = {in: ["id","created_at","updated_at"]}]; + optional uint32 directoryId = 5; + optional string status = 6[(validate.rules).string = {in: [ "PROGRESS","COMPLETED"]}]; +} + +message ListFileReply { + message File { + uint32 id = 1; + uint32 directoryId = 2; + string name = 3; + string type = 4; + uint32 size = 5; + string sha = 6; + string src = 7; + string url = 8; + string status = 9; + string uploadId = 10; + uint32 chunkCount = 11; + uint32 createdAt = 12; + uint32 updatedAt = 13; + } + + uint32 total = 1; + repeated File list = 2; +} + +message PrepareUploadFileRequest { + optional uint32 directoryId = 1[(validate.rules).uint32 = {gt: 0}]; + optional string directoryPath = 2[(validate.rules).string = {min_len: 1}]; + string name = 3[(validate.rules).string = {min_len: 1}]; + uint32 size = 4[(validate.rules).uint32 = {gt:0}]; + string sha = 5[(validate.rules).string = {min_len: 1}]; +} + +message PrepareUploadFileReply { + bool uploaded = 1; + optional string src = 2; + optional uint32 chunkSize = 3; + optional uint32 chunkCount = 4; + optional string uploadId = 5; + repeated uint32 uploadChunks = 6; + optional string sha = 7; + optional string url = 8; +} + +message UploadFileRequest{ + bytes data = 1[(validate.rules).bytes = {min_len:0}]; + string uploadId = 2[(validate.rules).string = {min_len:1}]; + uint32 index = 3[(validate.rules).uint32 = {gt:0}];; +} + +message UploadFileReply{ + string src = 1; + string sha = 2; + string url = 3; +} + +message UpdateFileRequest { + uint32 id = 1[(validate.rules).uint32 = {gt: 0}]; + uint32 directoryId = 2[(validate.rules).uint32 = {gt: 0}]; + string name = 3[(validate.rules).string = {min_len: 1}]; +} + +message UpdateFileReply { +} + +message DeleteFileRequest { + repeated uint32 ids = 1[(validate.rules).repeated = {min_items: 1, unique:true, max_items:50}]; +} + +message DeleteFileReply { + uint32 total = 1; +} + diff --git a/api/resource/file/resource_file_service.proto b/api/resource/file/resource_file_service.proto new file mode 100755 index 0000000..90697b4 --- /dev/null +++ b/api/resource/file/resource_file_service.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; + +package resource.api.resource.file.v1; + +option go_package = "./v1;v1"; +option java_multiple_files = true; +option java_package = "resource.api.resource.file.v1"; +option java_outer_classname = "FileV1"; + +import "api/resource/file/resource_file.proto"; +import "google/api/annotations.proto"; + +service File{ + + // GetFile 获取指定的文件信息 + rpc GetFile (GetFileRequest) returns (GetFileReply) { + option (google.api.http) = { + get: "/resource/api/v1/file", + }; + } + + // ListFile 获取文件信息列表 + rpc ListFile (ListFileRequest) returns (ListFileReply) { + option (google.api.http) = { + get: "/resource/api/v1/files", + }; + } + + // PrepareUploadFile 预上传文件信息 + rpc PrepareUploadFile (PrepareUploadFileRequest) returns (PrepareUploadFileReply) { + option (google.api.http) = { + post: "/resource/api/v1/file/prepare_upload", + body: "*" + }; + } + + // UploadFile 上传文件 + rpc UploadFile(UploadFileRequest) returns (UploadFileReply){} + + // UpdateFile 更新文件信息 + rpc UpdateFile (UpdateFileRequest) returns (UpdateFileReply) { + option (google.api.http) = { + put: "/resource/api/v1/file", + body: "*" + }; + } + + // DeleteFile 删除文件信息 + rpc DeleteFile (DeleteFileRequest) returns (DeleteFileReply) { + option (google.api.http) = { + delete: "/resource/api/v1/file", + }; + } + +} \ No newline at end of file diff --git a/api/resource/file/v1/resource_file.pb.go b/api/resource/file/v1/resource_file.pb.go new file mode 100644 index 0000000..b7a2879 --- /dev/null +++ b/api/resource/file/v1/resource_file.pb.go @@ -0,0 +1,1586 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: api/resource/file/resource_file.proto + +package v1 + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + 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) +) + +type StaticFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` + Expire string `protobuf:"bytes,2,opt,name=expire,proto3" json:"expire,omitempty"` + Sign string `protobuf:"bytes,3,opt,name=sign,proto3" json:"sign,omitempty"` + Width uint32 `protobuf:"varint,4,opt,name=width,proto3" json:"width,omitempty"` + Height uint32 `protobuf:"varint,5,opt,name=height,proto3" json:"height,omitempty"` + Mode string `protobuf:"bytes,6,opt,name=mode,proto3" json:"mode,omitempty"` + Download bool `protobuf:"varint,7,opt,name=download,proto3" json:"download,omitempty"` + SaveName string `protobuf:"bytes,8,opt,name=saveName,proto3" json:"saveName,omitempty"` +} + +func (x *StaticFileRequest) Reset() { + *x = StaticFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StaticFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StaticFileRequest) ProtoMessage() {} + +func (x *StaticFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_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 StaticFileRequest.ProtoReflect.Descriptor instead. +func (*StaticFileRequest) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{0} +} + +func (x *StaticFileRequest) GetSrc() string { + if x != nil { + return x.Src + } + return "" +} + +func (x *StaticFileRequest) GetExpire() string { + if x != nil { + return x.Expire + } + return "" +} + +func (x *StaticFileRequest) GetSign() string { + if x != nil { + return x.Sign + } + return "" +} + +func (x *StaticFileRequest) GetWidth() uint32 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *StaticFileRequest) GetHeight() uint32 { + if x != nil { + return x.Height + } + return 0 +} + +func (x *StaticFileRequest) GetMode() string { + if x != nil { + return x.Mode + } + return "" +} + +func (x *StaticFileRequest) GetDownload() bool { + if x != nil { + return x.Download + } + return false +} + +func (x *StaticFileRequest) GetSaveName() string { + if x != nil { + return x.SaveName + } + return "" +} + +type StaticFileReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Mime string `protobuf:"bytes,2,opt,name=mime,proto3" json:"mime,omitempty"` +} + +func (x *StaticFileReply) Reset() { + *x = StaticFileReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StaticFileReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StaticFileReply) ProtoMessage() {} + +func (x *StaticFileReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[1] + 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 StaticFileReply.ProtoReflect.Descriptor instead. +func (*StaticFileReply) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{1} +} + +func (x *StaticFileReply) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *StaticFileReply) GetMime() string { + if x != nil { + return x.Mime + } + return "" +} + +type GetFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"` + Sha *string `protobuf:"bytes,2,opt,name=sha,proto3,oneof" json:"sha,omitempty"` +} + +func (x *GetFileRequest) Reset() { + *x = GetFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileRequest) ProtoMessage() {} + +func (x *GetFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[2] + 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 GetFileRequest.ProtoReflect.Descriptor instead. +func (*GetFileRequest) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{2} +} + +func (x *GetFileRequest) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *GetFileRequest) GetSha() string { + if x != nil && x.Sha != nil { + return *x.Sha + } + return "" +} + +type GetFileReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + DirectoryId uint32 `protobuf:"varint,2,opt,name=directoryId,proto3" json:"directoryId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` + Size uint32 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + Sha string `protobuf:"bytes,6,opt,name=sha,proto3" json:"sha,omitempty"` + Src string `protobuf:"bytes,7,opt,name=src,proto3" json:"src,omitempty"` + Url string `protobuf:"bytes,8,opt,name=url,proto3" json:"url,omitempty"` + Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"` + UploadId string `protobuf:"bytes,10,opt,name=uploadId,proto3" json:"uploadId,omitempty"` + ChunkCount uint32 `protobuf:"varint,11,opt,name=chunkCount,proto3" json:"chunkCount,omitempty"` + CreatedAt uint32 `protobuf:"varint,12,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt uint32 `protobuf:"varint,13,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` +} + +func (x *GetFileReply) Reset() { + *x = GetFileReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileReply) ProtoMessage() {} + +func (x *GetFileReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[3] + 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 GetFileReply.ProtoReflect.Descriptor instead. +func (*GetFileReply) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{3} +} + +func (x *GetFileReply) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *GetFileReply) GetDirectoryId() uint32 { + if x != nil { + return x.DirectoryId + } + return 0 +} + +func (x *GetFileReply) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetFileReply) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *GetFileReply) GetSize() uint32 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *GetFileReply) GetSha() string { + if x != nil { + return x.Sha + } + return "" +} + +func (x *GetFileReply) GetSrc() string { + if x != nil { + return x.Src + } + return "" +} + +func (x *GetFileReply) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *GetFileReply) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *GetFileReply) GetUploadId() string { + if x != nil { + return x.UploadId + } + return "" +} + +func (x *GetFileReply) GetChunkCount() uint32 { + if x != nil { + return x.ChunkCount + } + return 0 +} + +func (x *GetFileReply) GetCreatedAt() uint32 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *GetFileReply) GetUpdatedAt() uint32 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +type ListFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page uint32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + Order *string `protobuf:"bytes,3,opt,name=order,proto3,oneof" json:"order,omitempty"` + OrderBy *string `protobuf:"bytes,4,opt,name=orderBy,proto3,oneof" json:"orderBy,omitempty"` + DirectoryId *uint32 `protobuf:"varint,5,opt,name=directoryId,proto3,oneof" json:"directoryId,omitempty"` + Status *string `protobuf:"bytes,6,opt,name=status,proto3,oneof" json:"status,omitempty"` +} + +func (x *ListFileRequest) Reset() { + *x = ListFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFileRequest) ProtoMessage() {} + +func (x *ListFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[4] + 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 ListFileRequest.ProtoReflect.Descriptor instead. +func (*ListFileRequest) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{4} +} + +func (x *ListFileRequest) GetPage() uint32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ListFileRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListFileRequest) GetOrder() string { + if x != nil && x.Order != nil { + return *x.Order + } + return "" +} + +func (x *ListFileRequest) GetOrderBy() string { + if x != nil && x.OrderBy != nil { + return *x.OrderBy + } + return "" +} + +func (x *ListFileRequest) GetDirectoryId() uint32 { + if x != nil && x.DirectoryId != nil { + return *x.DirectoryId + } + return 0 +} + +func (x *ListFileRequest) GetStatus() string { + if x != nil && x.Status != nil { + return *x.Status + } + return "" +} + +type ListFileReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*ListFileReply_File `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *ListFileReply) Reset() { + *x = ListFileReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFileReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFileReply) ProtoMessage() {} + +func (x *ListFileReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[5] + 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 ListFileReply.ProtoReflect.Descriptor instead. +func (*ListFileReply) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{5} +} + +func (x *ListFileReply) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ListFileReply) GetList() []*ListFileReply_File { + if x != nil { + return x.List + } + return nil +} + +type PrepareUploadFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DirectoryId *uint32 `protobuf:"varint,1,opt,name=directoryId,proto3,oneof" json:"directoryId,omitempty"` + DirectoryPath *string `protobuf:"bytes,2,opt,name=directoryPath,proto3,oneof" json:"directoryPath,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Size uint32 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` + Sha string `protobuf:"bytes,5,opt,name=sha,proto3" json:"sha,omitempty"` +} + +func (x *PrepareUploadFileRequest) Reset() { + *x = PrepareUploadFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrepareUploadFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareUploadFileRequest) ProtoMessage() {} + +func (x *PrepareUploadFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[6] + 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 PrepareUploadFileRequest.ProtoReflect.Descriptor instead. +func (*PrepareUploadFileRequest) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{6} +} + +func (x *PrepareUploadFileRequest) GetDirectoryId() uint32 { + if x != nil && x.DirectoryId != nil { + return *x.DirectoryId + } + return 0 +} + +func (x *PrepareUploadFileRequest) GetDirectoryPath() string { + if x != nil && x.DirectoryPath != nil { + return *x.DirectoryPath + } + return "" +} + +func (x *PrepareUploadFileRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PrepareUploadFileRequest) GetSize() uint32 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *PrepareUploadFileRequest) GetSha() string { + if x != nil { + return x.Sha + } + return "" +} + +type PrepareUploadFileReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uploaded bool `protobuf:"varint,1,opt,name=uploaded,proto3" json:"uploaded,omitempty"` + Src *string `protobuf:"bytes,2,opt,name=src,proto3,oneof" json:"src,omitempty"` + ChunkSize *uint32 `protobuf:"varint,3,opt,name=chunkSize,proto3,oneof" json:"chunkSize,omitempty"` + ChunkCount *uint32 `protobuf:"varint,4,opt,name=chunkCount,proto3,oneof" json:"chunkCount,omitempty"` + UploadId *string `protobuf:"bytes,5,opt,name=uploadId,proto3,oneof" json:"uploadId,omitempty"` + UploadChunks []uint32 `protobuf:"varint,6,rep,packed,name=uploadChunks,proto3" json:"uploadChunks,omitempty"` + Sha *string `protobuf:"bytes,7,opt,name=sha,proto3,oneof" json:"sha,omitempty"` + Url *string `protobuf:"bytes,8,opt,name=url,proto3,oneof" json:"url,omitempty"` +} + +func (x *PrepareUploadFileReply) Reset() { + *x = PrepareUploadFileReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrepareUploadFileReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareUploadFileReply) ProtoMessage() {} + +func (x *PrepareUploadFileReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[7] + 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 PrepareUploadFileReply.ProtoReflect.Descriptor instead. +func (*PrepareUploadFileReply) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{7} +} + +func (x *PrepareUploadFileReply) GetUploaded() bool { + if x != nil { + return x.Uploaded + } + return false +} + +func (x *PrepareUploadFileReply) GetSrc() string { + if x != nil && x.Src != nil { + return *x.Src + } + return "" +} + +func (x *PrepareUploadFileReply) GetChunkSize() uint32 { + if x != nil && x.ChunkSize != nil { + return *x.ChunkSize + } + return 0 +} + +func (x *PrepareUploadFileReply) GetChunkCount() uint32 { + if x != nil && x.ChunkCount != nil { + return *x.ChunkCount + } + return 0 +} + +func (x *PrepareUploadFileReply) GetUploadId() string { + if x != nil && x.UploadId != nil { + return *x.UploadId + } + return "" +} + +func (x *PrepareUploadFileReply) GetUploadChunks() []uint32 { + if x != nil { + return x.UploadChunks + } + return nil +} + +func (x *PrepareUploadFileReply) GetSha() string { + if x != nil && x.Sha != nil { + return *x.Sha + } + return "" +} + +func (x *PrepareUploadFileReply) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +type UploadFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + UploadId string `protobuf:"bytes,2,opt,name=uploadId,proto3" json:"uploadId,omitempty"` + Index uint32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` +} + +func (x *UploadFileRequest) Reset() { + *x = UploadFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadFileRequest) ProtoMessage() {} + +func (x *UploadFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[8] + 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 UploadFileRequest.ProtoReflect.Descriptor instead. +func (*UploadFileRequest) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{8} +} + +func (x *UploadFileRequest) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *UploadFileRequest) GetUploadId() string { + if x != nil { + return x.UploadId + } + return "" +} + +func (x *UploadFileRequest) GetIndex() uint32 { + if x != nil { + return x.Index + } + return 0 +} + +type UploadFileReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` + Sha string `protobuf:"bytes,2,opt,name=sha,proto3" json:"sha,omitempty"` + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *UploadFileReply) Reset() { + *x = UploadFileReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadFileReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadFileReply) ProtoMessage() {} + +func (x *UploadFileReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[9] + 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 UploadFileReply.ProtoReflect.Descriptor instead. +func (*UploadFileReply) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{9} +} + +func (x *UploadFileReply) GetSrc() string { + if x != nil { + return x.Src + } + return "" +} + +func (x *UploadFileReply) GetSha() string { + if x != nil { + return x.Sha + } + return "" +} + +func (x *UploadFileReply) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type UpdateFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + DirectoryId uint32 `protobuf:"varint,2,opt,name=directoryId,proto3" json:"directoryId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UpdateFileRequest) Reset() { + *x = UpdateFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateFileRequest) ProtoMessage() {} + +func (x *UpdateFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[10] + 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 UpdateFileRequest.ProtoReflect.Descriptor instead. +func (*UpdateFileRequest) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdateFileRequest) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UpdateFileRequest) GetDirectoryId() uint32 { + if x != nil { + return x.DirectoryId + } + return 0 +} + +func (x *UpdateFileRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type UpdateFileReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateFileReply) Reset() { + *x = UpdateFileReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateFileReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateFileReply) ProtoMessage() {} + +func (x *UpdateFileReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[11] + 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 UpdateFileReply.ProtoReflect.Descriptor instead. +func (*UpdateFileReply) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{11} +} + +type DeleteFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ids []uint32 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"` +} + +func (x *DeleteFileRequest) Reset() { + *x = DeleteFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteFileRequest) ProtoMessage() {} + +func (x *DeleteFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[12] + 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 DeleteFileRequest.ProtoReflect.Descriptor instead. +func (*DeleteFileRequest) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{12} +} + +func (x *DeleteFileRequest) GetIds() []uint32 { + if x != nil { + return x.Ids + } + return nil +} + +type DeleteFileReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` +} + +func (x *DeleteFileReply) Reset() { + *x = DeleteFileReply{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteFileReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteFileReply) ProtoMessage() {} + +func (x *DeleteFileReply) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[13] + 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 DeleteFileReply.ProtoReflect.Descriptor instead. +func (*DeleteFileReply) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{13} +} + +func (x *DeleteFileReply) GetTotal() uint32 { + if x != nil { + return x.Total + } + return 0 +} + +type ListFileReply_File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + DirectoryId uint32 `protobuf:"varint,2,opt,name=directoryId,proto3" json:"directoryId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` + Size uint32 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + Sha string `protobuf:"bytes,6,opt,name=sha,proto3" json:"sha,omitempty"` + Src string `protobuf:"bytes,7,opt,name=src,proto3" json:"src,omitempty"` + Url string `protobuf:"bytes,8,opt,name=url,proto3" json:"url,omitempty"` + Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"` + UploadId string `protobuf:"bytes,10,opt,name=uploadId,proto3" json:"uploadId,omitempty"` + ChunkCount uint32 `protobuf:"varint,11,opt,name=chunkCount,proto3" json:"chunkCount,omitempty"` + CreatedAt uint32 `protobuf:"varint,12,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt uint32 `protobuf:"varint,13,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` +} + +func (x *ListFileReply_File) Reset() { + *x = ListFileReply_File{} + if protoimpl.UnsafeEnabled { + mi := &file_api_resource_file_resource_file_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListFileReply_File) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListFileReply_File) ProtoMessage() {} + +func (x *ListFileReply_File) ProtoReflect() protoreflect.Message { + mi := &file_api_resource_file_resource_file_proto_msgTypes[14] + 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 ListFileReply_File.ProtoReflect.Descriptor instead. +func (*ListFileReply_File) Descriptor() ([]byte, []int) { + return file_api_resource_file_resource_file_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *ListFileReply_File) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ListFileReply_File) GetDirectoryId() uint32 { + if x != nil { + return x.DirectoryId + } + return 0 +} + +func (x *ListFileReply_File) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ListFileReply_File) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ListFileReply_File) GetSize() uint32 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *ListFileReply_File) GetSha() string { + if x != nil { + return x.Sha + } + return "" +} + +func (x *ListFileReply_File) GetSrc() string { + if x != nil { + return x.Src + } + return "" +} + +func (x *ListFileReply_File) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *ListFileReply_File) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *ListFileReply_File) GetUploadId() string { + if x != nil { + return x.UploadId + } + return "" +} + +func (x *ListFileReply_File) GetChunkCount() uint32 { + if x != nil { + return x.ChunkCount + } + return 0 +} + +func (x *ListFileReply_File) GetCreatedAt() uint32 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ListFileReply_File) GetUpdatedAt() uint32 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +var File_api_resource_file_resource_file_proto protoreflect.FileDescriptor + +var file_api_resource_file_resource_file_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, + 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xe6, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x72, 0x63, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x73, 0x72, 0x63, + 0x12, 0x1f, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x12, 0x14, + 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x77, + 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x73, 0x61, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x73, 0x61, 0x76, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x39, 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x74, + 0x69, 0x63, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x12, 0x0a, 0x04, 0x6d, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, + 0x69, 0x6d, 0x65, 0x22, 0x5d, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, + 0x88, 0x01, 0x01, 0x12, 0x1e, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x01, 0x52, 0x03, 0x73, 0x68, 0x61, + 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x73, + 0x68, 0x61, 0x22, 0xc2, 0x02, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x73, 0x68, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x72, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x73, 0x72, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x1a, 0x0a, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xd5, 0x02, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x70, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, + 0x20, 0x00, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, + 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x2a, + 0x04, 0x18, 0x32, 0x20, 0x00, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x2b, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10, + 0xfa, 0x42, 0x0d, 0x72, 0x0b, 0x52, 0x03, 0x61, 0x73, 0x63, 0x52, 0x04, 0x64, 0x65, 0x73, 0x63, + 0x48, 0x00, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x40, 0x0a, 0x07, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xfa, + 0x42, 0x1e, 0x72, 0x1c, 0x52, 0x02, 0x69, 0x64, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x48, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x88, 0x01, 0x01, 0x12, 0x25, + 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xfa, 0x42, 0x17, 0x72, 0x15, 0x52, 0x08, 0x50, 0x52, + 0x4f, 0x47, 0x52, 0x45, 0x53, 0x53, 0x52, 0x09, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, + 0x44, 0x48, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x42, 0x79, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x79, 0x49, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0xa9, 0x03, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x45, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x1a, 0xba, + 0x02, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x72, 0x63, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x72, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, 0x12, + 0x1e, 0x0a, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xf5, 0x01, 0x0a, 0x18, + 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x32, 0x0a, 0x0d, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x01, 0x52, 0x0d, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, + 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x73, 0x68, + 0x61, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, + 0x64, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x50, + 0x61, 0x74, 0x68, 0x22, 0xc8, 0x02, 0x0a, 0x16, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, + 0x0a, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x12, 0x15, 0x0a, 0x03, 0x73, 0x72, + 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x73, 0x72, 0x63, 0x88, 0x01, + 0x01, 0x12, 0x21, 0x0a, 0x09, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x09, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x69, 0x7a, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x0a, 0x63, 0x68, 0x75, 0x6e, + 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x75, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x08, 0x75, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0c, 0x75, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x12, 0x15, + 0x0a, 0x03, 0x73, 0x68, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x03, 0x73, + 0x68, 0x61, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x05, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, + 0x5f, 0x73, 0x72, 0x63, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x69, + 0x7a, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, 0x42, 0x06, + 0x0a, 0x04, 0x5f, 0x73, 0x68, 0x61, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x75, 0x72, 0x6c, 0x22, 0x74, + 0x0a, 0x11, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x7a, 0x02, 0x10, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x23, 0x0a, 0x08, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x08, 0x75, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x22, 0x47, 0x0a, 0x0f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x72, 0x63, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x72, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x68, 0x61, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x68, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x74, 0x0a, + 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x29, 0x0a, 0x0b, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x20, 0x00, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x33, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x03, 0x69, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x92, 0x01, 0x06, + 0x08, 0x01, 0x10, 0x32, 0x18, 0x01, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x27, 0x0a, 0x0f, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x32, 0x0a, 0x1d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x56, 0x31, 0x50, 0x01, 0x5a, + 0x07, 0x2e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_resource_file_resource_file_proto_rawDescOnce sync.Once + file_api_resource_file_resource_file_proto_rawDescData = file_api_resource_file_resource_file_proto_rawDesc +) + +func file_api_resource_file_resource_file_proto_rawDescGZIP() []byte { + file_api_resource_file_resource_file_proto_rawDescOnce.Do(func() { + file_api_resource_file_resource_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_resource_file_resource_file_proto_rawDescData) + }) + return file_api_resource_file_resource_file_proto_rawDescData +} + +var file_api_resource_file_resource_file_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_api_resource_file_resource_file_proto_goTypes = []interface{}{ + (*StaticFileRequest)(nil), // 0: resource.api.resource.file.v1.StaticFileRequest + (*StaticFileReply)(nil), // 1: resource.api.resource.file.v1.StaticFileReply + (*GetFileRequest)(nil), // 2: resource.api.resource.file.v1.GetFileRequest + (*GetFileReply)(nil), // 3: resource.api.resource.file.v1.GetFileReply + (*ListFileRequest)(nil), // 4: resource.api.resource.file.v1.ListFileRequest + (*ListFileReply)(nil), // 5: resource.api.resource.file.v1.ListFileReply + (*PrepareUploadFileRequest)(nil), // 6: resource.api.resource.file.v1.PrepareUploadFileRequest + (*PrepareUploadFileReply)(nil), // 7: resource.api.resource.file.v1.PrepareUploadFileReply + (*UploadFileRequest)(nil), // 8: resource.api.resource.file.v1.UploadFileRequest + (*UploadFileReply)(nil), // 9: resource.api.resource.file.v1.UploadFileReply + (*UpdateFileRequest)(nil), // 10: resource.api.resource.file.v1.UpdateFileRequest + (*UpdateFileReply)(nil), // 11: resource.api.resource.file.v1.UpdateFileReply + (*DeleteFileRequest)(nil), // 12: resource.api.resource.file.v1.DeleteFileRequest + (*DeleteFileReply)(nil), // 13: resource.api.resource.file.v1.DeleteFileReply + (*ListFileReply_File)(nil), // 14: resource.api.resource.file.v1.ListFileReply.File +} +var file_api_resource_file_resource_file_proto_depIdxs = []int32{ + 14, // 0: resource.api.resource.file.v1.ListFileReply.list:type_name -> resource.api.resource.file.v1.ListFileReply.File + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_resource_file_resource_file_proto_init() } +func file_api_resource_file_resource_file_proto_init() { + if File_api_resource_file_resource_file_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_resource_file_resource_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StaticFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StaticFileReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFileReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListFileReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrepareUploadFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrepareUploadFileReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadFileReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateFileReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteFileReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_resource_file_resource_file_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListFileReply_File); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_api_resource_file_resource_file_proto_msgTypes[2].OneofWrappers = []interface{}{} + file_api_resource_file_resource_file_proto_msgTypes[4].OneofWrappers = []interface{}{} + file_api_resource_file_resource_file_proto_msgTypes[6].OneofWrappers = []interface{}{} + file_api_resource_file_resource_file_proto_msgTypes[7].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_resource_file_resource_file_proto_rawDesc, + NumEnums: 0, + NumMessages: 15, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_resource_file_resource_file_proto_goTypes, + DependencyIndexes: file_api_resource_file_resource_file_proto_depIdxs, + MessageInfos: file_api_resource_file_resource_file_proto_msgTypes, + }.Build() + File_api_resource_file_resource_file_proto = out.File + file_api_resource_file_resource_file_proto_rawDesc = nil + file_api_resource_file_resource_file_proto_goTypes = nil + file_api_resource_file_resource_file_proto_depIdxs = nil +} diff --git a/api/file/v1/resource_file.pb.validate.go b/api/resource/file/v1/resource_file.pb.validate.go similarity index 63% rename from api/file/v1/resource_file.pb.validate.go rename to api/resource/file/v1/resource_file.pb.validate.go index d541ce1..96fcfb3 100644 --- a/api/file/v1/resource_file.pb.validate.go +++ b/api/resource/file/v1/resource_file.pb.validate.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-validate. DO NOT EDIT. -// source: resource_file.proto +// source: api/resource/file/resource_file.proto package v1 @@ -35,58 +35,191 @@ var ( _ = sort.Sort ) -// Validate checks the field values on File with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *File) Validate() error { +// Validate checks the field values on StaticFileRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *StaticFileRequest) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on File with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in FileMultiError, or nil if none found. -func (m *File) ValidateAll() error { +// ValidateAll checks the field values on StaticFileRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// StaticFileRequestMultiError, or nil if none found. +func (m *StaticFileRequest) ValidateAll() error { return m.validate(true) } -func (m *File) validate(all bool) error { +func (m *StaticFileRequest) validate(all bool) error { if m == nil { return nil } var errors []error - // no validation rules for Id + if utf8.RuneCountInString(m.GetSrc()) < 1 { + err := StaticFileRequestValidationError{ + field: "Src", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } - // no validation rules for DirectoryId + if utf8.RuneCountInString(m.GetExpire()) < 1 { + err := StaticFileRequestValidationError{ + field: "Expire", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } - // no validation rules for Name + if utf8.RuneCountInString(m.GetSign()) < 1 { + err := StaticFileRequestValidationError{ + field: "Sign", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } - // no validation rules for Type + // no validation rules for Width - // no validation rules for Size + // no validation rules for Height - // no validation rules for Sha + // no validation rules for Mode - // no validation rules for Src + // no validation rules for Download - // no validation rules for Storage + // no validation rules for SaveName - // no validation rules for CreatedAt + if len(errors) > 0 { + return StaticFileRequestMultiError(errors) + } + + return nil +} + +// StaticFileRequestMultiError is an error wrapping multiple validation errors +// returned by StaticFileRequest.ValidateAll() if the designated constraints +// aren't met. +type StaticFileRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m StaticFileRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m StaticFileRequestMultiError) AllErrors() []error { return m } + +// StaticFileRequestValidationError is the validation error returned by +// StaticFileRequest.Validate if the designated constraints aren't met. +type StaticFileRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e StaticFileRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e StaticFileRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e StaticFileRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e StaticFileRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e StaticFileRequestValidationError) ErrorName() string { + return "StaticFileRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e StaticFileRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sStaticFileRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = StaticFileRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = StaticFileRequestValidationError{} + +// Validate checks the field values on StaticFileReply with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *StaticFileReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on StaticFileReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// StaticFileReplyMultiError, or nil if none found. +func (m *StaticFileReply) ValidateAll() error { + return m.validate(true) +} + +func (m *StaticFileReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Data + + // no validation rules for Mime if len(errors) > 0 { - return FileMultiError(errors) + return StaticFileReplyMultiError(errors) } return nil } -// FileMultiError is an error wrapping multiple validation errors returned by -// File.ValidateAll() if the designated constraints aren't met. -type FileMultiError []error +// StaticFileReplyMultiError is an error wrapping multiple validation errors +// returned by StaticFileReply.ValidateAll() if the designated constraints +// aren't met. +type StaticFileReplyMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m FileMultiError) Error() string { +func (m StaticFileReplyMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -95,11 +228,11 @@ func (m FileMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m FileMultiError) AllErrors() []error { return m } +func (m StaticFileReplyMultiError) AllErrors() []error { return m } -// FileValidationError is the validation error returned by File.Validate if the -// designated constraints aren't met. -type FileValidationError struct { +// StaticFileReplyValidationError is the validation error returned by +// StaticFileReply.Validate if the designated constraints aren't met. +type StaticFileReplyValidationError struct { field string reason string cause error @@ -107,22 +240,22 @@ type FileValidationError struct { } // Field function returns field value. -func (e FileValidationError) Field() string { return e.field } +func (e StaticFileReplyValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e FileValidationError) Reason() string { return e.reason } +func (e StaticFileReplyValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e FileValidationError) Cause() error { return e.cause } +func (e StaticFileReplyValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e FileValidationError) Key() bool { return e.key } +func (e StaticFileReplyValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e FileValidationError) ErrorName() string { return "FileValidationError" } +func (e StaticFileReplyValidationError) ErrorName() string { return "StaticFileReplyValidationError" } // Error satisfies the builtin error interface -func (e FileValidationError) Error() string { +func (e StaticFileReplyValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -134,14 +267,14 @@ func (e FileValidationError) Error() string { } return fmt.Sprintf( - "invalid %sFile.%s: %s%s", + "invalid %sStaticFileReply.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = FileValidationError{} +var _ error = StaticFileReplyValidationError{} var _ interface { Field() string @@ -149,7 +282,7 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = FileValidationError{} +} = StaticFileReplyValidationError{} // Validate checks the field values on GetFileRequest with the rules defined in // the proto definition for this message. If any rules are violated, the first @@ -173,32 +306,35 @@ func (m *GetFileRequest) validate(all bool) error { var errors []error - if utf8.RuneCountInString(m.GetSrc()) < 1 { - err := GetFileRequestValidationError{ - field: "Src", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for Width - - // no validation rules for Height - - // no validation rules for Mode + if m.Id != nil { - // no validation rules for IsRange + if m.GetId() <= 0 { + err := GetFileRequestValidationError{ + field: "Id", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } - // no validation rules for Start + } - // no validation rules for End + if m.Sha != nil { - // no validation rules for Download + if utf8.RuneCountInString(m.GetSha()) < 1 { + err := GetFileRequestValidationError{ + field: "Sha", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } - // no validation rules for SaveName + } if len(errors) > 0 { return GetFileRequestMultiError(errors) @@ -300,9 +436,31 @@ func (m *GetFileReply) validate(all bool) error { var errors []error - // no validation rules for Data + // no validation rules for Id - // no validation rules for Mime + // no validation rules for DirectoryId + + // no validation rules for Name + + // no validation rules for Type + + // no validation rules for Size + + // no validation rules for Sha + + // no validation rules for Src + + // no validation rules for Url + + // no validation rules for Status + + // no validation rules for UploadId + + // no validation rules for ChunkCount + + // no validation rules for CreatedAt + + // no validation rules for UpdatedAt if len(errors) > 0 { return GetFileReplyMultiError(errors) @@ -381,32 +539,43 @@ var _ interface { ErrorName() string } = GetFileReplyValidationError{} -// Validate checks the field values on GetFileByShaRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetFileByShaRequest) Validate() error { +// Validate checks the field values on ListFileRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ListFileRequest) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on GetFileByShaRequest with the rules +// ValidateAll checks the field values on ListFileRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// GetFileByShaRequestMultiError, or nil if none found. -func (m *GetFileByShaRequest) ValidateAll() error { +// ListFileRequestMultiError, or nil if none found. +func (m *ListFileRequest) ValidateAll() error { return m.validate(true) } -func (m *GetFileByShaRequest) validate(all bool) error { +func (m *ListFileRequest) validate(all bool) error { if m == nil { return nil } var errors []error - if utf8.RuneCountInString(m.GetSha()) < 1 { - err := GetFileByShaRequestValidationError{ - field: "Sha", - reason: "value length must be at least 1 runes", + if m.GetPage() <= 0 { + err := ListFileRequestValidationError{ + field: "Page", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetPageSize(); val <= 0 || val > 50 { + err := ListFileRequestValidationError{ + field: "PageSize", + reason: "value must be inside range (0, 50]", } if !all { return err @@ -414,20 +583,69 @@ func (m *GetFileByShaRequest) validate(all bool) error { errors = append(errors, err) } + if m.Order != nil { + + if _, ok := _ListFileRequest_Order_InLookup[m.GetOrder()]; !ok { + err := ListFileRequestValidationError{ + field: "Order", + reason: "value must be in list [asc desc]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.OrderBy != nil { + + if _, ok := _ListFileRequest_OrderBy_InLookup[m.GetOrderBy()]; !ok { + err := ListFileRequestValidationError{ + field: "OrderBy", + reason: "value must be in list [id created_at updated_at]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.DirectoryId != nil { + // no validation rules for DirectoryId + } + + if m.Status != nil { + + if _, ok := _ListFileRequest_Status_InLookup[m.GetStatus()]; !ok { + err := ListFileRequestValidationError{ + field: "Status", + reason: "value must be in list [PROGRESS COMPLETED]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + if len(errors) > 0 { - return GetFileByShaRequestMultiError(errors) + return ListFileRequestMultiError(errors) } return nil } -// GetFileByShaRequestMultiError is an error wrapping multiple validation -// errors returned by GetFileByShaRequest.ValidateAll() if the designated -// constraints aren't met. -type GetFileByShaRequestMultiError []error +// ListFileRequestMultiError is an error wrapping multiple validation errors +// returned by ListFileRequest.ValidateAll() if the designated constraints +// aren't met. +type ListFileRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m GetFileByShaRequestMultiError) Error() string { +func (m ListFileRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -436,11 +654,11 @@ func (m GetFileByShaRequestMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m GetFileByShaRequestMultiError) AllErrors() []error { return m } +func (m ListFileRequestMultiError) AllErrors() []error { return m } -// GetFileByShaRequestValidationError is the validation error returned by -// GetFileByShaRequest.Validate if the designated constraints aren't met. -type GetFileByShaRequestValidationError struct { +// ListFileRequestValidationError is the validation error returned by +// ListFileRequest.Validate if the designated constraints aren't met. +type ListFileRequestValidationError struct { field string reason string cause error @@ -448,24 +666,174 @@ type GetFileByShaRequestValidationError struct { } // Field function returns field value. -func (e GetFileByShaRequestValidationError) Field() string { return e.field } +func (e ListFileRequestValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e GetFileByShaRequestValidationError) Reason() string { return e.reason } +func (e ListFileRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e GetFileByShaRequestValidationError) Cause() error { return e.cause } +func (e ListFileRequestValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e GetFileByShaRequestValidationError) Key() bool { return e.key } +func (e ListFileRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e GetFileByShaRequestValidationError) ErrorName() string { - return "GetFileByShaRequestValidationError" +func (e ListFileRequestValidationError) ErrorName() string { return "ListFileRequestValidationError" } + +// Error satisfies the builtin error interface +func (e ListFileRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListFileRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) } +var _ error = ListFileRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListFileRequestValidationError{} + +var _ListFileRequest_Order_InLookup = map[string]struct{}{ + "asc": {}, + "desc": {}, +} + +var _ListFileRequest_OrderBy_InLookup = map[string]struct{}{ + "id": {}, + "created_at": {}, + "updated_at": {}, +} + +var _ListFileRequest_Status_InLookup = map[string]struct{}{ + "PROGRESS": {}, + "COMPLETED": {}, +} + +// Validate checks the field values on ListFileReply with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ListFileReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListFileReply with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ListFileReplyMultiError, or +// nil if none found. +func (m *ListFileReply) ValidateAll() error { + return m.validate(true) +} + +func (m *ListFileReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Total + + for idx, item := range m.GetList() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListFileReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListFileReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListFileReplyValidationError{ + field: fmt.Sprintf("List[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListFileReplyMultiError(errors) + } + + return nil +} + +// ListFileReplyMultiError is an error wrapping multiple validation errors +// returned by ListFileReply.ValidateAll() if the designated constraints +// aren't met. +type ListFileReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListFileReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListFileReplyMultiError) AllErrors() []error { return m } + +// ListFileReplyValidationError is the validation error returned by +// ListFileReply.Validate if the designated constraints aren't met. +type ListFileReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListFileReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListFileReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListFileReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListFileReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListFileReplyValidationError) ErrorName() string { return "ListFileReplyValidationError" } + // Error satisfies the builtin error interface -func (e GetFileByShaRequestValidationError) Error() string { +func (e ListFileReplyValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -477,14 +845,14 @@ func (e GetFileByShaRequestValidationError) Error() string { } return fmt.Sprintf( - "invalid %sGetFileByShaRequest.%s: %s%s", + "invalid %sListFileReply.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = GetFileByShaRequestValidationError{} +var _ error = ListFileReplyValidationError{} var _ interface { Field() string @@ -492,7 +860,7 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = GetFileByShaRequestValidationError{} +} = ListFileReplyValidationError{} // Validate checks the field values on PrepareUploadFileRequest with the rules // defined in the proto definition for this message. If any rules are @@ -516,13 +884,9 @@ func (m *PrepareUploadFileRequest) validate(all bool) error { var errors []error - // no validation rules for DirectoryId - - // no validation rules for DirectoryPath - - if utf8.RuneCountInString(m.GetApp()) < 1 { + if utf8.RuneCountInString(m.GetName()) < 1 { err := PrepareUploadFileRequestValidationError{ - field: "App", + field: "Name", reason: "value length must be at least 1 runes", } if !all { @@ -531,10 +895,10 @@ func (m *PrepareUploadFileRequest) validate(all bool) error { errors = append(errors, err) } - if utf8.RuneCountInString(m.GetName()) < 1 { + if m.GetSize() <= 0 { err := PrepareUploadFileRequestValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", + field: "Size", + reason: "value must be greater than 0", } if !all { return err @@ -553,15 +917,34 @@ func (m *PrepareUploadFileRequest) validate(all bool) error { errors = append(errors, err) } - if m.GetSize() <= 0 { - err := PrepareUploadFileRequestValidationError{ - field: "Size", - reason: "value must be greater than 0", + if m.DirectoryId != nil { + + if m.GetDirectoryId() <= 0 { + err := PrepareUploadFileRequestValidationError{ + field: "DirectoryId", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) } - if !all { - return err + + } + + if m.DirectoryPath != nil { + + if utf8.RuneCountInString(m.GetDirectoryPath()) < 1 { + err := PrepareUploadFileRequestValidationError{ + field: "DirectoryPath", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) } - errors = append(errors, err) + } if len(errors) > 0 { @@ -666,9 +1049,7 @@ func (m *PrepareUploadFileReply) validate(all bool) error { var errors []error - if m.Uploaded != nil { - // no validation rules for Uploaded - } + // no validation rules for Uploaded if m.Src != nil { // no validation rules for Src @@ -690,6 +1071,10 @@ func (m *PrepareUploadFileReply) validate(all bool) error { // no validation rules for Sha } + if m.Url != nil { + // no validation rules for Url + } + if len(errors) > 0 { return PrepareUploadFileReplyMultiError(errors) } @@ -770,32 +1155,32 @@ var _ interface { ErrorName() string } = PrepareUploadFileReplyValidationError{} -// Validate checks the field values on PageFileRequest with the rules defined +// Validate checks the field values on UploadFileRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. -func (m *PageFileRequest) Validate() error { +func (m *UploadFileRequest) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on PageFileRequest with the rules +// ValidateAll checks the field values on UploadFileRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// PageFileRequestMultiError, or nil if none found. -func (m *PageFileRequest) ValidateAll() error { +// UploadFileRequestMultiError, or nil if none found. +func (m *UploadFileRequest) ValidateAll() error { return m.validate(true) } -func (m *PageFileRequest) validate(all bool) error { +func (m *UploadFileRequest) validate(all bool) error { if m == nil { return nil } var errors []error - if m.GetDirectoryId() <= 0 { - err := PageFileRequestValidationError{ - field: "DirectoryId", - reason: "value must be greater than 0", + if len(m.GetData()) < 0 { + err := UploadFileRequestValidationError{ + field: "Data", + reason: "value length must be at least 0 bytes", } if !all { return err @@ -803,9 +1188,9 @@ func (m *PageFileRequest) validate(all bool) error { errors = append(errors, err) } - if utf8.RuneCountInString(m.GetApp()) < 1 { - err := PageFileRequestValidationError{ - field: "App", + if utf8.RuneCountInString(m.GetUploadId()) < 1 { + err := UploadFileRequestValidationError{ + field: "UploadId", reason: "value length must be at least 1 runes", } if !all { @@ -814,9 +1199,9 @@ func (m *PageFileRequest) validate(all bool) error { errors = append(errors, err) } - if m.GetPage() <= 0 { - err := PageFileRequestValidationError{ - field: "Page", + if m.GetIndex() <= 0 { + err := UploadFileRequestValidationError{ + field: "Index", reason: "value must be greater than 0", } if !all { @@ -825,35 +1210,20 @@ func (m *PageFileRequest) validate(all bool) error { errors = append(errors, err) } - if val := m.GetPageSize(); val <= 0 || val > 100 { - err := PageFileRequestValidationError{ - field: "PageSize", - reason: "value must be inside range (0, 100]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.Name != nil { - // no validation rules for Name - } - if len(errors) > 0 { - return PageFileRequestMultiError(errors) + return UploadFileRequestMultiError(errors) } return nil } -// PageFileRequestMultiError is an error wrapping multiple validation errors -// returned by PageFileRequest.ValidateAll() if the designated constraints +// UploadFileRequestMultiError is an error wrapping multiple validation errors +// returned by UploadFileRequest.ValidateAll() if the designated constraints // aren't met. -type PageFileRequestMultiError []error +type UploadFileRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m PageFileRequestMultiError) Error() string { +func (m UploadFileRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -862,11 +1232,11 @@ func (m PageFileRequestMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m PageFileRequestMultiError) AllErrors() []error { return m } +func (m UploadFileRequestMultiError) AllErrors() []error { return m } -// PageFileRequestValidationError is the validation error returned by -// PageFileRequest.Validate if the designated constraints aren't met. -type PageFileRequestValidationError struct { +// UploadFileRequestValidationError is the validation error returned by +// UploadFileRequest.Validate if the designated constraints aren't met. +type UploadFileRequestValidationError struct { field string reason string cause error @@ -874,22 +1244,24 @@ type PageFileRequestValidationError struct { } // Field function returns field value. -func (e PageFileRequestValidationError) Field() string { return e.field } +func (e UploadFileRequestValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e PageFileRequestValidationError) Reason() string { return e.reason } +func (e UploadFileRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e PageFileRequestValidationError) Cause() error { return e.cause } +func (e UploadFileRequestValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e PageFileRequestValidationError) Key() bool { return e.key } +func (e UploadFileRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e PageFileRequestValidationError) ErrorName() string { return "PageFileRequestValidationError" } +func (e UploadFileRequestValidationError) ErrorName() string { + return "UploadFileRequestValidationError" +} // Error satisfies the builtin error interface -func (e PageFileRequestValidationError) Error() string { +func (e UploadFileRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -901,14 +1273,14 @@ func (e PageFileRequestValidationError) Error() string { } return fmt.Sprintf( - "invalid %sPageFileRequest.%s: %s%s", + "invalid %sUploadFileRequest.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = PageFileRequestValidationError{} +var _ error = UploadFileRequestValidationError{} var _ interface { Field() string @@ -916,82 +1288,50 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = PageFileRequestValidationError{} - -// Validate checks the field values on PageFileReply with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *PageFileReply) Validate() error { - return m.validate(false) -} +} = UploadFileRequestValidationError{} -// ValidateAll checks the field values on PageFileReply with the rules defined +// Validate checks the field values on UploadFileReply with the rules defined // in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in PageFileReplyMultiError, or -// nil if none found. -func (m *PageFileReply) ValidateAll() error { - return m.validate(true) -} - -func (m *PageFileReply) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetList() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PageFileReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PageFileReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PageFileReplyValidationError{ - field: fmt.Sprintf("List[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } +// first error encountered is returned, or nil if there are no violations. +func (m *UploadFileReply) Validate() error { + return m.validate(false) +} - } +// ValidateAll checks the field values on UploadFileReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UploadFileReplyMultiError, or nil if none found. +func (m *UploadFileReply) ValidateAll() error { + return m.validate(true) +} - if m.Total != nil { - // no validation rules for Total +func (m *UploadFileReply) validate(all bool) error { + if m == nil { + return nil } + var errors []error + + // no validation rules for Src + + // no validation rules for Sha + + // no validation rules for Url + if len(errors) > 0 { - return PageFileReplyMultiError(errors) + return UploadFileReplyMultiError(errors) } return nil } -// PageFileReplyMultiError is an error wrapping multiple validation errors -// returned by PageFileReply.ValidateAll() if the designated constraints +// UploadFileReplyMultiError is an error wrapping multiple validation errors +// returned by UploadFileReply.ValidateAll() if the designated constraints // aren't met. -type PageFileReplyMultiError []error +type UploadFileReplyMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m PageFileReplyMultiError) Error() string { +func (m UploadFileReplyMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1000,11 +1340,11 @@ func (m PageFileReplyMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m PageFileReplyMultiError) AllErrors() []error { return m } +func (m UploadFileReplyMultiError) AllErrors() []error { return m } -// PageFileReplyValidationError is the validation error returned by -// PageFileReply.Validate if the designated constraints aren't met. -type PageFileReplyValidationError struct { +// UploadFileReplyValidationError is the validation error returned by +// UploadFileReply.Validate if the designated constraints aren't met. +type UploadFileReplyValidationError struct { field string reason string cause error @@ -1012,22 +1352,22 @@ type PageFileReplyValidationError struct { } // Field function returns field value. -func (e PageFileReplyValidationError) Field() string { return e.field } +func (e UploadFileReplyValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e PageFileReplyValidationError) Reason() string { return e.reason } +func (e UploadFileReplyValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e PageFileReplyValidationError) Cause() error { return e.cause } +func (e UploadFileReplyValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e PageFileReplyValidationError) Key() bool { return e.key } +func (e UploadFileReplyValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e PageFileReplyValidationError) ErrorName() string { return "PageFileReplyValidationError" } +func (e UploadFileReplyValidationError) ErrorName() string { return "UploadFileReplyValidationError" } // Error satisfies the builtin error interface -func (e PageFileReplyValidationError) Error() string { +func (e UploadFileReplyValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1039,14 +1379,14 @@ func (e PageFileReplyValidationError) Error() string { } return fmt.Sprintf( - "invalid %sPageFileReply.%s: %s%s", + "invalid %sUploadFileReply.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = PageFileReplyValidationError{} +var _ error = UploadFileReplyValidationError{} var _ interface { Field() string @@ -1054,7 +1394,7 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = PageFileReplyValidationError{} +} = UploadFileReplyValidationError{} // Validate checks the field values on UpdateFileRequest with the rules defined // in the proto definition for this message. If any rules are violated, the @@ -1089,10 +1429,10 @@ func (m *UpdateFileRequest) validate(all bool) error { errors = append(errors, err) } - if utf8.RuneCountInString(m.GetApp()) < 1 { + if m.GetDirectoryId() <= 0 { err := UpdateFileRequestValidationError{ - field: "App", - reason: "value length must be at least 1 runes", + field: "DirectoryId", + reason: "value must be greater than 0", } if !all { return err @@ -1111,17 +1451,6 @@ func (m *UpdateFileRequest) validate(all bool) error { errors = append(errors, err) } - if m.GetDirectoryId() <= 0 { - err := UpdateFileRequestValidationError{ - field: "DirectoryId", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - if len(errors) > 0 { return UpdateFileRequestMultiError(errors) } @@ -1202,6 +1531,106 @@ var _ interface { ErrorName() string } = UpdateFileRequestValidationError{} +// Validate checks the field values on UpdateFileReply with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *UpdateFileReply) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateFileReply with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpdateFileReplyMultiError, or nil if none found. +func (m *UpdateFileReply) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateFileReply) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return UpdateFileReplyMultiError(errors) + } + + return nil +} + +// UpdateFileReplyMultiError is an error wrapping multiple validation errors +// returned by UpdateFileReply.ValidateAll() if the designated constraints +// aren't met. +type UpdateFileReplyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateFileReplyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpdateFileReplyMultiError) AllErrors() []error { return m } + +// UpdateFileReplyValidationError is the validation error returned by +// UpdateFileReply.Validate if the designated constraints aren't met. +type UpdateFileReplyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateFileReplyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateFileReplyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateFileReplyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateFileReplyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateFileReplyValidationError) ErrorName() string { return "UpdateFileReplyValidationError" } + +// Error satisfies the builtin error interface +func (e UpdateFileReplyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpdateFileReply.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateFileReplyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateFileReplyValidationError{} + // Validate checks the field values on DeleteFileRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. @@ -1224,10 +1653,10 @@ func (m *DeleteFileRequest) validate(all bool) error { var errors []error - if len(m.GetIds()) < 1 { + if l := len(m.GetIds()); l < 1 || l > 50 { err := DeleteFileRequestValidationError{ field: "Ids", - reason: "value must contain at least 1 item(s)", + reason: "value must contain between 1 and 50 items, inclusive", } if !all { return err @@ -1235,26 +1664,25 @@ func (m *DeleteFileRequest) validate(all bool) error { errors = append(errors, err) } - if utf8.RuneCountInString(m.GetApp()) < 1 { - err := DeleteFileRequestValidationError{ - field: "App", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } + _DeleteFileRequest_Ids_Unique := make(map[uint32]struct{}, len(m.GetIds())) - if m.GetDirectoryId() <= 0 { - err := DeleteFileRequestValidationError{ - field: "DirectoryId", - reason: "value must be greater than 0", - } - if !all { - return err + for idx, item := range m.GetIds() { + _, _ = idx, item + + if _, exists := _DeleteFileRequest_Ids_Unique[item]; exists { + err := DeleteFileRequestValidationError{ + field: fmt.Sprintf("Ids[%v]", idx), + reason: "repeated value must contain unique items", + } + if !all { + return err + } + errors = append(errors, err) + } else { + _DeleteFileRequest_Ids_Unique[item] = struct{}{} } - errors = append(errors, err) + + // no validation rules for Ids[idx] } if len(errors) > 0 { @@ -1337,75 +1765,44 @@ var _ interface { ErrorName() string } = DeleteFileRequestValidationError{} -// Validate checks the field values on UploadFileRequest with the rules defined +// Validate checks the field values on DeleteFileReply with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. -func (m *UploadFileRequest) Validate() error { +func (m *DeleteFileReply) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on UploadFileRequest with the rules +// ValidateAll checks the field values on DeleteFileReply with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// UploadFileRequestMultiError, or nil if none found. -func (m *UploadFileRequest) ValidateAll() error { +// DeleteFileReplyMultiError, or nil if none found. +func (m *DeleteFileReply) ValidateAll() error { return m.validate(true) } -func (m *UploadFileRequest) validate(all bool) error { +func (m *DeleteFileReply) validate(all bool) error { if m == nil { return nil } var errors []error - if len(m.GetData()) < 0 { - err := UploadFileRequestValidationError{ - field: "Data", - reason: "value length must be at least 0 bytes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetUploadId()) < 1 { - err := UploadFileRequestValidationError{ - field: "UploadId", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetIndex() <= 0 { - err := UploadFileRequestValidationError{ - field: "Index", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } + // no validation rules for Total if len(errors) > 0 { - return UploadFileRequestMultiError(errors) + return DeleteFileReplyMultiError(errors) } return nil } -// UploadFileRequestMultiError is an error wrapping multiple validation errors -// returned by UploadFileRequest.ValidateAll() if the designated constraints +// DeleteFileReplyMultiError is an error wrapping multiple validation errors +// returned by DeleteFileReply.ValidateAll() if the designated constraints // aren't met. -type UploadFileRequestMultiError []error +type DeleteFileReplyMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m UploadFileRequestMultiError) Error() string { +func (m DeleteFileReplyMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1414,11 +1811,11 @@ func (m UploadFileRequestMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m UploadFileRequestMultiError) AllErrors() []error { return m } +func (m DeleteFileReplyMultiError) AllErrors() []error { return m } -// UploadFileRequestValidationError is the validation error returned by -// UploadFileRequest.Validate if the designated constraints aren't met. -type UploadFileRequestValidationError struct { +// DeleteFileReplyValidationError is the validation error returned by +// DeleteFileReply.Validate if the designated constraints aren't met. +type DeleteFileReplyValidationError struct { field string reason string cause error @@ -1426,24 +1823,22 @@ type UploadFileRequestValidationError struct { } // Field function returns field value. -func (e UploadFileRequestValidationError) Field() string { return e.field } +func (e DeleteFileReplyValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e UploadFileRequestValidationError) Reason() string { return e.reason } +func (e DeleteFileReplyValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e UploadFileRequestValidationError) Cause() error { return e.cause } +func (e DeleteFileReplyValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e UploadFileRequestValidationError) Key() bool { return e.key } +func (e DeleteFileReplyValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e UploadFileRequestValidationError) ErrorName() string { - return "UploadFileRequestValidationError" -} +func (e DeleteFileReplyValidationError) ErrorName() string { return "DeleteFileReplyValidationError" } // Error satisfies the builtin error interface -func (e UploadFileRequestValidationError) Error() string { +func (e DeleteFileReplyValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1455,14 +1850,14 @@ func (e UploadFileRequestValidationError) Error() string { } return fmt.Sprintf( - "invalid %sUploadFileRequest.%s: %s%s", + "invalid %sDeleteFileReply.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = UploadFileRequestValidationError{} +var _ error = DeleteFileReplyValidationError{} var _ interface { Field() string @@ -1470,48 +1865,70 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = UploadFileRequestValidationError{} +} = DeleteFileReplyValidationError{} -// Validate checks the field values on UploadFileReply with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *UploadFileReply) Validate() error { +// Validate checks the field values on ListFileReply_File with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListFileReply_File) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on UploadFileReply with the rules +// ValidateAll checks the field values on ListFileReply_File with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// UploadFileReplyMultiError, or nil if none found. -func (m *UploadFileReply) ValidateAll() error { +// ListFileReply_FileMultiError, or nil if none found. +func (m *ListFileReply_File) ValidateAll() error { return m.validate(true) } -func (m *UploadFileReply) validate(all bool) error { +func (m *ListFileReply_File) validate(all bool) error { if m == nil { return nil } var errors []error - // no validation rules for Src + // no validation rules for Id + + // no validation rules for DirectoryId + + // no validation rules for Name + + // no validation rules for Type + + // no validation rules for Size // no validation rules for Sha + // no validation rules for Src + + // no validation rules for Url + + // no validation rules for Status + + // no validation rules for UploadId + + // no validation rules for ChunkCount + + // no validation rules for CreatedAt + + // no validation rules for UpdatedAt + if len(errors) > 0 { - return UploadFileReplyMultiError(errors) + return ListFileReply_FileMultiError(errors) } return nil } -// UploadFileReplyMultiError is an error wrapping multiple validation errors -// returned by UploadFileReply.ValidateAll() if the designated constraints +// ListFileReply_FileMultiError is an error wrapping multiple validation errors +// returned by ListFileReply_File.ValidateAll() if the designated constraints // aren't met. -type UploadFileReplyMultiError []error +type ListFileReply_FileMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m UploadFileReplyMultiError) Error() string { +func (m ListFileReply_FileMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -1520,11 +1937,11 @@ func (m UploadFileReplyMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m UploadFileReplyMultiError) AllErrors() []error { return m } +func (m ListFileReply_FileMultiError) AllErrors() []error { return m } -// UploadFileReplyValidationError is the validation error returned by -// UploadFileReply.Validate if the designated constraints aren't met. -type UploadFileReplyValidationError struct { +// ListFileReply_FileValidationError is the validation error returned by +// ListFileReply_File.Validate if the designated constraints aren't met. +type ListFileReply_FileValidationError struct { field string reason string cause error @@ -1532,22 +1949,24 @@ type UploadFileReplyValidationError struct { } // Field function returns field value. -func (e UploadFileReplyValidationError) Field() string { return e.field } +func (e ListFileReply_FileValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e UploadFileReplyValidationError) Reason() string { return e.reason } +func (e ListFileReply_FileValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e UploadFileReplyValidationError) Cause() error { return e.cause } +func (e ListFileReply_FileValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e UploadFileReplyValidationError) Key() bool { return e.key } +func (e ListFileReply_FileValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e UploadFileReplyValidationError) ErrorName() string { return "UploadFileReplyValidationError" } +func (e ListFileReply_FileValidationError) ErrorName() string { + return "ListFileReply_FileValidationError" +} // Error satisfies the builtin error interface -func (e UploadFileReplyValidationError) Error() string { +func (e ListFileReply_FileValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -1559,14 +1978,14 @@ func (e UploadFileReplyValidationError) Error() string { } return fmt.Sprintf( - "invalid %sUploadFileReply.%s: %s%s", + "invalid %sListFileReply_File.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = UploadFileReplyValidationError{} +var _ error = ListFileReply_FileValidationError{} var _ interface { Field() string @@ -1574,4 +1993,4 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = UploadFileReplyValidationError{} +} = ListFileReply_FileValidationError{} diff --git a/api/resource/file/v1/resource_file_service.pb.go b/api/resource/file/v1/resource_file_service.pb.go new file mode 100644 index 0000000..be0ff0b --- /dev/null +++ b/api/resource/file/v1/resource_file_service.pb.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v4.24.4 +// source: api/resource/file/resource_file_service.proto + +package v1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_api_resource_file_resource_file_service_proto protoreflect.FileDescriptor + +var file_api_resource_file_resource_file_service_proto_rawDesc = []byte{ + 0x0a, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, + 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x1d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x25, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x66, 0x69, 0x6c, + 0x65, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x32, 0xe4, 0x06, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x84, 0x01, 0x0a, + 0x07, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x2d, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, + 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x12, 0x88, 0x01, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, + 0x12, 0x2e, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1e, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x12, 0xb4, + 0x01, 0x0a, 0x11, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x46, 0x69, 0x6c, 0x65, 0x12, 0x37, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, + 0x65, 0x70, 0x61, 0x72, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, 0x22, + 0x24, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x5f, 0x75, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x70, 0x0a, 0x0a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, + 0x69, 0x6c, 0x65, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x90, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x66, + 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, + 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, + 0x3a, 0x01, 0x2a, 0x1a, 0x15, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x8d, 0x01, 0x0a, 0x0a, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1d, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x32, 0x0a, 0x1d, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x06, 0x46, 0x69, 0x6c, + 0x65, 0x56, 0x31, 0x50, 0x01, 0x5a, 0x07, 0x2e, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_api_resource_file_resource_file_service_proto_goTypes = []interface{}{ + (*GetFileRequest)(nil), // 0: resource.api.resource.file.v1.GetFileRequest + (*ListFileRequest)(nil), // 1: resource.api.resource.file.v1.ListFileRequest + (*PrepareUploadFileRequest)(nil), // 2: resource.api.resource.file.v1.PrepareUploadFileRequest + (*UploadFileRequest)(nil), // 3: resource.api.resource.file.v1.UploadFileRequest + (*UpdateFileRequest)(nil), // 4: resource.api.resource.file.v1.UpdateFileRequest + (*DeleteFileRequest)(nil), // 5: resource.api.resource.file.v1.DeleteFileRequest + (*GetFileReply)(nil), // 6: resource.api.resource.file.v1.GetFileReply + (*ListFileReply)(nil), // 7: resource.api.resource.file.v1.ListFileReply + (*PrepareUploadFileReply)(nil), // 8: resource.api.resource.file.v1.PrepareUploadFileReply + (*UploadFileReply)(nil), // 9: resource.api.resource.file.v1.UploadFileReply + (*UpdateFileReply)(nil), // 10: resource.api.resource.file.v1.UpdateFileReply + (*DeleteFileReply)(nil), // 11: resource.api.resource.file.v1.DeleteFileReply +} +var file_api_resource_file_resource_file_service_proto_depIdxs = []int32{ + 0, // 0: resource.api.resource.file.v1.File.GetFile:input_type -> resource.api.resource.file.v1.GetFileRequest + 1, // 1: resource.api.resource.file.v1.File.ListFile:input_type -> resource.api.resource.file.v1.ListFileRequest + 2, // 2: resource.api.resource.file.v1.File.PrepareUploadFile:input_type -> resource.api.resource.file.v1.PrepareUploadFileRequest + 3, // 3: resource.api.resource.file.v1.File.UploadFile:input_type -> resource.api.resource.file.v1.UploadFileRequest + 4, // 4: resource.api.resource.file.v1.File.UpdateFile:input_type -> resource.api.resource.file.v1.UpdateFileRequest + 5, // 5: resource.api.resource.file.v1.File.DeleteFile:input_type -> resource.api.resource.file.v1.DeleteFileRequest + 6, // 6: resource.api.resource.file.v1.File.GetFile:output_type -> resource.api.resource.file.v1.GetFileReply + 7, // 7: resource.api.resource.file.v1.File.ListFile:output_type -> resource.api.resource.file.v1.ListFileReply + 8, // 8: resource.api.resource.file.v1.File.PrepareUploadFile:output_type -> resource.api.resource.file.v1.PrepareUploadFileReply + 9, // 9: resource.api.resource.file.v1.File.UploadFile:output_type -> resource.api.resource.file.v1.UploadFileReply + 10, // 10: resource.api.resource.file.v1.File.UpdateFile:output_type -> resource.api.resource.file.v1.UpdateFileReply + 11, // 11: resource.api.resource.file.v1.File.DeleteFile:output_type -> resource.api.resource.file.v1.DeleteFileReply + 6, // [6:12] is the sub-list for method output_type + 0, // [0:6] 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_api_resource_file_resource_file_service_proto_init() } +func file_api_resource_file_resource_file_service_proto_init() { + if File_api_resource_file_resource_file_service_proto != nil { + return + } + file_api_resource_file_resource_file_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_resource_file_resource_file_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_resource_file_resource_file_service_proto_goTypes, + DependencyIndexes: file_api_resource_file_resource_file_service_proto_depIdxs, + }.Build() + File_api_resource_file_resource_file_service_proto = out.File + file_api_resource_file_resource_file_service_proto_rawDesc = nil + file_api_resource_file_resource_file_service_proto_goTypes = nil + file_api_resource_file_resource_file_service_proto_depIdxs = nil +} diff --git a/api/resource/file/v1/resource_file_service_grpc.pb.go b/api/resource/file/v1/resource_file_service_grpc.pb.go new file mode 100644 index 0000000..109f08d --- /dev/null +++ b/api/resource/file/v1/resource_file_service_grpc.pb.go @@ -0,0 +1,306 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.4 +// source: api/resource/file/resource_file_service.proto + +package v1 + +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 ( + File_GetFile_FullMethodName = "/resource.api.resource.file.v1.File/GetFile" + File_ListFile_FullMethodName = "/resource.api.resource.file.v1.File/ListFile" + File_PrepareUploadFile_FullMethodName = "/resource.api.resource.file.v1.File/PrepareUploadFile" + File_UploadFile_FullMethodName = "/resource.api.resource.file.v1.File/UploadFile" + File_UpdateFile_FullMethodName = "/resource.api.resource.file.v1.File/UpdateFile" + File_DeleteFile_FullMethodName = "/resource.api.resource.file.v1.File/DeleteFile" +) + +// FileClient is the client API for File 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 FileClient interface { + // GetFile 获取指定的文件信息 + GetFile(ctx context.Context, in *GetFileRequest, opts ...grpc.CallOption) (*GetFileReply, error) + // ListFile 获取文件信息列表 + ListFile(ctx context.Context, in *ListFileRequest, opts ...grpc.CallOption) (*ListFileReply, error) + // PrepareUploadFile 预上传文件信息 + PrepareUploadFile(ctx context.Context, in *PrepareUploadFileRequest, opts ...grpc.CallOption) (*PrepareUploadFileReply, error) + // UploadFile 上传文件 + UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileReply, error) + // UpdateFile 更新文件信息 + UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...grpc.CallOption) (*UpdateFileReply, error) + // DeleteFile 删除文件信息 + DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*DeleteFileReply, error) +} + +type fileClient struct { + cc grpc.ClientConnInterface +} + +func NewFileClient(cc grpc.ClientConnInterface) FileClient { + return &fileClient{cc} +} + +func (c *fileClient) GetFile(ctx context.Context, in *GetFileRequest, opts ...grpc.CallOption) (*GetFileReply, error) { + out := new(GetFileReply) + err := c.cc.Invoke(ctx, File_GetFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) ListFile(ctx context.Context, in *ListFileRequest, opts ...grpc.CallOption) (*ListFileReply, error) { + out := new(ListFileReply) + err := c.cc.Invoke(ctx, File_ListFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) PrepareUploadFile(ctx context.Context, in *PrepareUploadFileRequest, opts ...grpc.CallOption) (*PrepareUploadFileReply, error) { + out := new(PrepareUploadFileReply) + err := c.cc.Invoke(ctx, File_PrepareUploadFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileReply, error) { + out := new(UploadFileReply) + err := c.cc.Invoke(ctx, File_UploadFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...grpc.CallOption) (*UpdateFileReply, error) { + out := new(UpdateFileReply) + err := c.cc.Invoke(ctx, File_UpdateFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...grpc.CallOption) (*DeleteFileReply, error) { + out := new(DeleteFileReply) + err := c.cc.Invoke(ctx, File_DeleteFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FileServer is the server API for File service. +// All implementations must embed UnimplementedFileServer +// for forward compatibility +type FileServer interface { + // GetFile 获取指定的文件信息 + GetFile(context.Context, *GetFileRequest) (*GetFileReply, error) + // ListFile 获取文件信息列表 + ListFile(context.Context, *ListFileRequest) (*ListFileReply, error) + // PrepareUploadFile 预上传文件信息 + PrepareUploadFile(context.Context, *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) + // UploadFile 上传文件 + UploadFile(context.Context, *UploadFileRequest) (*UploadFileReply, error) + // UpdateFile 更新文件信息 + UpdateFile(context.Context, *UpdateFileRequest) (*UpdateFileReply, error) + // DeleteFile 删除文件信息 + DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileReply, error) + mustEmbedUnimplementedFileServer() +} + +// UnimplementedFileServer must be embedded to have forward compatible implementations. +type UnimplementedFileServer struct { +} + +func (UnimplementedFileServer) GetFile(context.Context, *GetFileRequest) (*GetFileReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFile not implemented") +} +func (UnimplementedFileServer) ListFile(context.Context, *ListFileRequest) (*ListFileReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListFile not implemented") +} +func (UnimplementedFileServer) PrepareUploadFile(context.Context, *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method PrepareUploadFile not implemented") +} +func (UnimplementedFileServer) UploadFile(context.Context, *UploadFileRequest) (*UploadFileReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method UploadFile not implemented") +} +func (UnimplementedFileServer) UpdateFile(context.Context, *UpdateFileRequest) (*UpdateFileReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateFile not implemented") +} +func (UnimplementedFileServer) DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteFile not implemented") +} +func (UnimplementedFileServer) mustEmbedUnimplementedFileServer() {} + +// UnsafeFileServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FileServer will +// result in compilation errors. +type UnsafeFileServer interface { + mustEmbedUnimplementedFileServer() +} + +func RegisterFileServer(s grpc.ServiceRegistrar, srv FileServer) { + s.RegisterService(&File_ServiceDesc, srv) +} + +func _File_GetFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).GetFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: File_GetFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).GetFile(ctx, req.(*GetFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_ListFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).ListFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: File_ListFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).ListFile(ctx, req.(*ListFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_PrepareUploadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrepareUploadFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).PrepareUploadFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: File_PrepareUploadFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).PrepareUploadFile(ctx, req.(*PrepareUploadFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_UploadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UploadFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).UploadFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: File_UploadFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).UploadFile(ctx, req.(*UploadFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_UpdateFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).UpdateFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: File_UpdateFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).UpdateFile(ctx, req.(*UpdateFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_DeleteFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).DeleteFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: File_DeleteFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).DeleteFile(ctx, req.(*DeleteFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// File_ServiceDesc is the grpc.ServiceDesc for File service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var File_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "resource.api.resource.file.v1.File", + HandlerType: (*FileServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetFile", + Handler: _File_GetFile_Handler, + }, + { + MethodName: "ListFile", + Handler: _File_ListFile_Handler, + }, + { + MethodName: "PrepareUploadFile", + Handler: _File_PrepareUploadFile_Handler, + }, + { + MethodName: "UploadFile", + Handler: _File_UploadFile_Handler, + }, + { + MethodName: "UpdateFile", + Handler: _File_UpdateFile_Handler, + }, + { + MethodName: "DeleteFile", + Handler: _File_DeleteFile_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/resource/file/resource_file_service.proto", +} diff --git a/api/resource/file/v1/resource_file_service_http.pb.go b/api/resource/file/v1/resource_file_service_http.pb.go new file mode 100644 index 0000000..9ad5ba1 --- /dev/null +++ b/api/resource/file/v1/resource_file_service_http.pb.go @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-go-http. DO NOT EDIT. +// versions: +// - protoc-gen-go-http v2.7.3 +// - protoc v4.24.4 +// source: api/resource/file/resource_file_service.proto + +package v1 + +import ( + context "context" + http "github.com/go-kratos/kratos/v2/transport/http" + binding "github.com/go-kratos/kratos/v2/transport/http/binding" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the kratos package it is being compiled against. +var _ = new(context.Context) +var _ = binding.EncodeURL + +const _ = http.SupportPackageIsVersion1 + +const OperationFileDeleteFile = "/resource.api.resource.file.v1.File/DeleteFile" +const OperationFileGetFile = "/resource.api.resource.file.v1.File/GetFile" +const OperationFileListFile = "/resource.api.resource.file.v1.File/ListFile" +const OperationFilePrepareUploadFile = "/resource.api.resource.file.v1.File/PrepareUploadFile" +const OperationFileUpdateFile = "/resource.api.resource.file.v1.File/UpdateFile" + +type FileHTTPServer interface { + // DeleteFile DeleteFile 删除文件信息 + DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileReply, error) + // GetFile GetFile 获取指定的文件信息 + GetFile(context.Context, *GetFileRequest) (*GetFileReply, error) + // ListFile ListFile 获取文件信息列表 + ListFile(context.Context, *ListFileRequest) (*ListFileReply, error) + // PrepareUploadFile PrepareUploadFile 预上传文件信息 + PrepareUploadFile(context.Context, *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) + // UpdateFile UpdateFile 更新文件信息 + UpdateFile(context.Context, *UpdateFileRequest) (*UpdateFileReply, error) +} + +func RegisterFileHTTPServer(s *http.Server, srv FileHTTPServer) { + r := s.Route("/") + r.GET("/resource/api/v1/file", _File_GetFile0_HTTP_Handler(srv)) + r.GET("/resource/api/v1/files", _File_ListFile0_HTTP_Handler(srv)) + r.POST("/resource/api/v1/file/prepare_upload", _File_PrepareUploadFile0_HTTP_Handler(srv)) + r.PUT("/resource/api/v1/file", _File_UpdateFile0_HTTP_Handler(srv)) + r.DELETE("/resource/api/v1/file", _File_DeleteFile0_HTTP_Handler(srv)) +} + +func _File_GetFile0_HTTP_Handler(srv FileHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in GetFileRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationFileGetFile) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.GetFile(ctx, req.(*GetFileRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*GetFileReply) + return ctx.Result(200, reply) + } +} + +func _File_ListFile0_HTTP_Handler(srv FileHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in ListFileRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationFileListFile) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.ListFile(ctx, req.(*ListFileRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*ListFileReply) + return ctx.Result(200, reply) + } +} + +func _File_PrepareUploadFile0_HTTP_Handler(srv FileHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in PrepareUploadFileRequest + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationFilePrepareUploadFile) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.PrepareUploadFile(ctx, req.(*PrepareUploadFileRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*PrepareUploadFileReply) + return ctx.Result(200, reply) + } +} + +func _File_UpdateFile0_HTTP_Handler(srv FileHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in UpdateFileRequest + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationFileUpdateFile) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.UpdateFile(ctx, req.(*UpdateFileRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*UpdateFileReply) + return ctx.Result(200, reply) + } +} + +func _File_DeleteFile0_HTTP_Handler(srv FileHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in DeleteFileRequest + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationFileDeleteFile) + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return srv.DeleteFile(ctx, req.(*DeleteFileRequest)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*DeleteFileReply) + return ctx.Result(200, reply) + } +} + +type FileHTTPClient interface { + DeleteFile(ctx context.Context, req *DeleteFileRequest, opts ...http.CallOption) (rsp *DeleteFileReply, err error) + GetFile(ctx context.Context, req *GetFileRequest, opts ...http.CallOption) (rsp *GetFileReply, err error) + ListFile(ctx context.Context, req *ListFileRequest, opts ...http.CallOption) (rsp *ListFileReply, err error) + PrepareUploadFile(ctx context.Context, req *PrepareUploadFileRequest, opts ...http.CallOption) (rsp *PrepareUploadFileReply, err error) + UpdateFile(ctx context.Context, req *UpdateFileRequest, opts ...http.CallOption) (rsp *UpdateFileReply, err error) +} + +type FileHTTPClientImpl struct { + cc *http.Client +} + +func NewFileHTTPClient(client *http.Client) FileHTTPClient { + return &FileHTTPClientImpl{client} +} + +func (c *FileHTTPClientImpl) DeleteFile(ctx context.Context, in *DeleteFileRequest, opts ...http.CallOption) (*DeleteFileReply, error) { + var out DeleteFileReply + pattern := "/resource/api/v1/file" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationFileDeleteFile)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "DELETE", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *FileHTTPClientImpl) GetFile(ctx context.Context, in *GetFileRequest, opts ...http.CallOption) (*GetFileReply, error) { + var out GetFileReply + pattern := "/resource/api/v1/file" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationFileGetFile)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *FileHTTPClientImpl) ListFile(ctx context.Context, in *ListFileRequest, opts ...http.CallOption) (*ListFileReply, error) { + var out ListFileReply + pattern := "/resource/api/v1/files" + path := binding.EncodeURL(pattern, in, true) + opts = append(opts, http.Operation(OperationFileListFile)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *FileHTTPClientImpl) PrepareUploadFile(ctx context.Context, in *PrepareUploadFileRequest, opts ...http.CallOption) (*PrepareUploadFileReply, error) { + var out PrepareUploadFileReply + pattern := "/resource/api/v1/file/prepare_upload" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationFilePrepareUploadFile)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *FileHTTPClientImpl) UpdateFile(ctx context.Context, in *UpdateFileRequest, opts ...http.CallOption) (*UpdateFileReply, error) { + var out UpdateFileReply + pattern := "/resource/api/v1/file" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationFileUpdateFile)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "PUT", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} diff --git a/autocode/directory.json b/autocode/directory.json new file mode 100644 index 0000000..986aa96 --- /dev/null +++ b/autocode/directory.json @@ -0,0 +1,126 @@ +{ + "table":"directory", + "keyword": "directory", + "module": "directory", + "comment": "文件目录信息", + "description": "文件目录信息", + "type": "tree", + "fields": [ + { + "keyword": "id", + "title": "主键", + "type": "primaryKey", + "required": true, + "default": "", + "operation": { + "create": false, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "parent_id", + "title": "父id", + "type": "foreignKey", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "name", + "title": "名称", + "type": "varchar64", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "scope", + "title": "权限类型", + "type": "char", + "required": true, + "default": "", + "rules": { + "in": ["PRIVATE", "PUBLIC"] + }, + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "accept", + "title": "允许后缀", + "type": "tinytext", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "max_size", + "title": "大小限额/M", + "type": "unsignedInteger", + "required": true, + "default": "", + "rules": { + "gte": 1 + }, + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + } + }, + + { + "keyword": "created_at", + "title": "创建时间", + "type": "time", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "updated_at", + "title": "更新时间", + "type": "time", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + } + ], + "index": [ + ["created_at"], + ["updated_at"] + ], + "methods": ["Get","List", "Create", "Update", "Delete"] +} \ No newline at end of file diff --git a/autocode/export.json b/autocode/export.json new file mode 100644 index 0000000..04eb32a --- /dev/null +++ b/autocode/export.json @@ -0,0 +1,189 @@ +{ + "table":"export", + "keyword": "export", + "module": "export", + "comment": "导出信息", + "description": "导出信息", + "type": "list", + "fields": [ + { + "keyword": "id", + "title": "主键", + "type": "primaryKey", + "required": true, + "default": "", + "operation": { + "create": false, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "user_id", + "title": "用户id", + "type": "foreignKey", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + }, + "queryType": "=" + }, + { + "keyword": "department_id", + "title": "部门id", + "type": "foreignKey", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + }, + "queryType": "=" + }, + { + "keyword": "scene", + "title": "场景", + "type": "char", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "name", + "title": "名称", + "type": "varchar64", + "required": true, + "default": "", + "operation": { + "create": true, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "size", + "title": "大小", + "type": "unsignedInteger", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "sha", + "title": "大小限额/M", + "type": "varchar64", + "required": false, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "src", + "title": "路径", + "type": "varchar128", + "required": false, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "status", + "title": "打包状态", + "type": "char", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "reason", + "title": "错误原因", + "type": "tinytext", + "required": false, + "default": "", + "operation": { + "create": true, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "expired_at", + "title": "过期时间", + "type": "time", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "created_at", + "title": "创建时间", + "type": "time", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "updated_at", + "title": "更新时间", + "type": "time", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + } + ], + "unique": [ + ["sha"] + ], + "index": [ + ["created_at"], + ["updated_at"] + ], + "methods": ["Get","List", "Create", "Update", "Delete"] +} \ No newline at end of file diff --git a/autocode/file.json b/autocode/file.json new file mode 100644 index 0000000..4e528b0 --- /dev/null +++ b/autocode/file.json @@ -0,0 +1,175 @@ +{ + "table":"file", + "keyword": "file", + "module": "file", + "comment": "文件信息", + "description": "文件信息", + "type": "list", + "fields": [ + { + "keyword": "id", + "title": "主键", + "type": "primaryKey", + "required": true, + "default": "", + "operation": { + "create": false, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "directory_id", + "title": "目录id", + "type": "foreignKey", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + }, + "queryType": "=" + }, + { + "keyword": "name", + "title": "名称", + "type": "varchar64", + "required": true, + "default": "", + "operation": { + "create": true, + "update": true, + "list": true, + "get": true + } + }, + { + "keyword": "type", + "title": "类型", + "type": "char", + "required": true, + "default": "", + "operation": { + "create": true, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "size", + "title": "大小", + "type": "unsignedInteger", + "required": true, + "default": "", + "operation": { + "create": true, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "sha", + "title": "大小限额/M", + "type": "varchar64", + "required": true, + "default": "", + "operation": { + "create": true, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "src", + "title": "路径", + "type": "varchar128", + "required": false, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "status", + "title": "上传状态", + "type": "char", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "upload_id", + "title": "上传id", + "type": "varchar64", + "required": true, + "default": "", + "operation": { + "create": true, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "chunk_count", + "title": "切片数量", + "type": "unsignedInteger", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "created_at", + "title": "创建时间", + "type": "time", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + }, + { + "keyword": "updated_at", + "title": "更新时间", + "type": "time", + "required": true, + "default": "", + "operation": { + "create": false, + "update": false, + "list": true, + "get": true + } + } + ], + "unique": [ + ["sha"] + ], + "index": [ + ["created_at"], + ["updated_at"] + ], + "methods": ["Get","List", "Create", "Update", "Delete"] +} \ No newline at end of file diff --git a/cmd/resource/main.go b/cmd/resource/main.go index 8ca61c5..7f758f7 100644 --- a/cmd/resource/main.go +++ b/cmd/resource/main.go @@ -8,43 +8,36 @@ import ( "github.com/go-kratos/kratos/v2" "github.com/go-kratos/kratos/v2/transport/grpc" "github.com/go-kratos/kratos/v2/transport/http" - configure "github.com/limes-cloud/configure/api/client" "github.com/limes-cloud/kratosx" "github.com/limes-cloud/kratosx/config" - "github.com/limes-cloud/kratosx/pkg/print" + "github.com/limes-cloud/kratosx/pkg/printx" _ "go.uber.org/automaxprocs" - resourceconf "github.com/limes-cloud/resource/internal/config" - "github.com/limes-cloud/resource/internal/router" + "github.com/limes-cloud/resource/internal/conf" "github.com/limes-cloud/resource/internal/service" ) func main() { app := kratosx.New( - kratosx.Config(configure.NewFromEnv()), kratosx.RegistrarServer(RegisterServer), kratosx.Options(kratos.AfterStart(func(ctx context.Context) error { kt := kratosx.MustContext(ctx) - print.ArtFont(fmt.Sprintf("Hello %s !", kt.Name())) + printx.ArtFont(fmt.Sprintf("Hello %s !", kt.Name())) return nil })), ) - if err := app.Run(); err != nil { log.Fatal("run service fail", err) } } func RegisterServer(c config.Config, hs *http.Server, gs *grpc.Server) { - // 初始化并监听配置变更 - conf := &resourceconf.Config{} + cfg := &conf.Config{} c.ScanWatch("business", func(value config.Value) { - if err := value.Scan(conf); err != nil { + if err := value.Scan(&cfg); err != nil { panic("business config format error:" + err.Error()) } }) - // 注册服务 - fileSrv := service.New(conf, hs, gs) - router.Register(hs, fileSrv) + service.New(cfg, hs, gs) } diff --git a/deploy/data.sql b/deploy/data.sql deleted file mode 100644 index 8a1b019..0000000 --- a/deploy/data.sql +++ /dev/null @@ -1,94 +0,0 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for chunk --- ---------------------------- -DROP TABLE IF EXISTS `chunk`; -CREATE TABLE `chunk` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分片id', - `upload_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '上传id', - `index` bigint NOT NULL COMMENT '切片下标', - `size` bigint NOT NULL COMMENT '切片大小', - `sha` varchar(128) NOT NULL COMMENT '切片sha', - `data` mediumblob NOT NULL COMMENT '切片数据', - `created_at` bigint unsigned DEFAULT NULL COMMENT '创建时间', - PRIMARY KEY (`id`), - UNIQUE KEY `upload_id` (`upload_id`,`index`), - UNIQUE KEY `ui` (`upload_id`,`index`), - KEY `idx_chunk_created_at` (`created_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - --- ---------------------------- --- Table structure for directory --- ---------------------------- -DROP TABLE IF EXISTS `directory`; -CREATE TABLE `directory` ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `created_at` bigint DEFAULT NULL COMMENT '创建时间', - `updated_at` bigint DEFAULT NULL COMMENT '修改时间', - `parent_id` int unsigned NOT NULL COMMENT '父id', - `name` varchar(128) NOT NULL COMMENT '目录名称', - `app` varchar(32) NOT NULL COMMENT '所属应用', - PRIMARY KEY (`id`), - UNIQUE KEY `pna` (`parent_id`,`name`,`app`), - KEY `idx_directory_created_at` (`created_at`), - KEY `idx_directory_updated_at` (`updated_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='目录信息'; - --- ---------------------------- --- Table structure for export --- ---------------------------- -DROP TABLE IF EXISTS `export`; -CREATE TABLE `export` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '文件id', - `user_id` bigint NOT NULL COMMENT '用户id', - `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '文件名', - `size` bigint NOT NULL DEFAULT '0' COMMENT '文件大小', - `version` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '版本', - `src` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '文件路径', - `reason` varchar(512) NOT NULL DEFAULT '' COMMENT '错误原因', - `status` varchar(32) NOT NULL DEFAULT '' COMMENT '导出状态', - `created_at` bigint unsigned DEFAULT NULL COMMENT '创建时间', - `updated_at` bigint unsigned DEFAULT NULL COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `version` (`version`,`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='导出任务'; - --- ---------------------------- --- Table structure for file --- ---------------------------- -DROP TABLE IF EXISTS `file`; -CREATE TABLE `file` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '文件id', - `directory_id` bigint NOT NULL COMMENT '目录id', - `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '文件名', - `type` varchar(64) NOT NULL COMMENT '文件类型', - `size` bigint NOT NULL COMMENT '文件大小', - `sha` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'sha值', - `src` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '文件路径', - `storage` varchar(32) NOT NULL COMMENT '存储引擎', - `status` enum('PROGRESS','COMPLETED','FAILED') DEFAULT 'PROGRESS' COMMENT '上传状态', - `upload_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '上传id', - `chunk_count` int DEFAULT '1' COMMENT '切片数量', - `created_at` bigint unsigned DEFAULT NULL COMMENT '创建时间', - `updated_at` bigint unsigned DEFAULT NULL COMMENT '修改时间', - `deleted_at` bigint unsigned DEFAULT NULL COMMENT '删除时间', - PRIMARY KEY (`id`), - UNIQUE KEY `sha` (`sha`,`directory_id`), - UNIQUE KEY `upload_id` (`upload_id`), - KEY `deleted_at` (`deleted_at`), - KEY `directory_id` (`directory_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件信息'; - --- ---------------------------- --- Table structure for gorm_init --- ---------------------------- -DROP TABLE IF EXISTS `gorm_init`; -CREATE TABLE `gorm_init` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `init` tinyint(1) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/examples/export_test.go b/examples/export_test.go deleted file mode 100644 index 2e3a091..0000000 --- a/examples/export_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package examples - -import ( - "context" - "testing" - - "github.com/go-kratos/kratos/v2/transport/grpc" - "github.com/limes-cloud/kratosx" - "github.com/zeebo/assert" - - exportpb "github.com/limes-cloud/resource/api/export/v1" -) - -func TestExport(t *testing.T) { - ctx := kratosx.MustContext(context.Background()) - insecure, err := grpc.DialInsecure(ctx, grpc.WithEndpoint("127.0.0.1:8003")) - assert.NoError(t, err) - - client := exportpb.NewServiceClient(insecure) - _, err = client.AddExport(ctx, &exportpb.AddExportRequest{ - Name: "test.zip", - Files: []*exportpb.AddExportRequest_ExportFile{ - { - Sha: "2a0786fe9127b8116bc30ed2ce9581e2", - Rename: "1", - }, - { - Sha: "36e2e87f7b73219343da52a28ba47eec", - Rename: "2", - }, - { - Sha: "6d06733ef579fbcef68b9f95745a3e99", - Rename: "3", - }, - }, - }) - assert.NoError(t, err) -} - -func TestExportExcel(t *testing.T) { - ctx := kratosx.MustContext(context.Background()) - insecure, err := grpc.DialInsecure(ctx, grpc.WithEndpoint("127.0.0.1:8003")) - assert.NoError(t, err) - - client := exportpb.NewServiceClient(insecure) - _, err = client.AddExportExcel(ctx, &exportpb.AddExportExcelRequest{ - Name: "test.zip", - Rows: []*exportpb.AddExportExcelRequest_Row{ - { - Cols: []*exportpb.AddExportExcelRequest_Col{ - { - Type: "string", - Value: "hello", - }, - { - Type: "string", - Value: "world", - }, - { - Type: "image", - Value: "2a0786fe9127b8116bc30ed2ce9581e2", - }, - }, - }, - { - Cols: []*exportpb.AddExportExcelRequest_Col{ - { - Type: "string", - Value: "hello1", - }, - { - Type: "string", - Value: "world2", - }, - { - Type: "image", - Value: "36e2e87f7b73219343da52a28ba47eec", - }, - }, - }, - }, - }) - assert.NoError(t, err) -} diff --git a/go.mod b/go.mod index 6e332b9..e6a1074 100644 --- a/go.mod +++ b/go.mod @@ -3,18 +3,14 @@ module github.com/limes-cloud/resource go 1.21.1 require ( - github.com/aliyun/aliyun-oss-go-sdk v3.0.1+incompatible + github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible github.com/envoyproxy/protoc-gen-validate v1.0.4 - github.com/gabriel-vasile/mimetype v1.4.3 github.com/go-kratos/kratos/v2 v2.7.3 - github.com/golang/protobuf v1.5.4 + github.com/go-redis/redis/v8 v8.11.5 github.com/google/uuid v1.6.0 - github.com/limes-cloud/configure v1.0.32 - github.com/limes-cloud/kratosx v1.0.31 - github.com/limes-cloud/manager v1.0.13 + github.com/limes-cloud/kratosx v1.0.39 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 - github.com/tencentyun/cos-go-sdk-v5 v0.7.45 - github.com/zeebo/assert v1.3.0 + github.com/tencentyun/cos-go-sdk-v5 v0.7.49 go.uber.org/automaxprocs v1.5.3 golang.org/x/image v0.15.0 google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6 @@ -29,6 +25,7 @@ require ( github.com/ClickHouse/clickhouse-go/v2 v2.23.2 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/armon/go-metrics v0.4.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect github.com/billcobbler/casbin-redis-watcher/v2 v2.0.0-20211014141847-d29c8619193d // indirect github.com/casbin/casbin/v2 v2.88.0 // indirect github.com/casbin/gorm-adapter/v3 v3.24.0 // indirect @@ -48,19 +45,22 @@ require ( github.com/go-faster/errors v0.7.1 // indirect github.com/go-kratos/aegis v0.2.1-0.20230616030432-99110a3f05f4 // indirect github.com/go-kratos/kratos/contrib/log/zap/v2 v2.0.0-20240504101732-d0d5761f9ca8 // indirect + github.com/go-kratos/kratos/contrib/metrics/prometheus/v2 v2.0.0-20240322155018-41971ffa647a // indirect github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240504101732-d0d5761f9ca8 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-playground/assert/v2 v2.2.0 // indirect github.com/go-playground/form/v4 v4.2.1 // indirect - github.com/go-redis/redis/v8 v8.11.5 // indirect + github.com/go-redsync/redsync/v4 v4.12.1 // indirect github.com/go-resty/resty/v2 v2.12.0 // indirect github.com/go-sql-driver/mysql v1.8.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect - github.com/google/go-querystring v1.1.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-querystring v1.0.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect @@ -92,27 +92,25 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/mojocn/base64Captcha v1.3.6 // indirect - github.com/mozillazg/go-httpheader v0.3.1 // indirect + github.com/mozillazg/go-httpheader v0.2.1 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/panjf2000/ants/v2 v2.9.1 // indirect github.com/paulmach/orb v0.11.1 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.46.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/richardlehane/mscfb v1.0.4 // indirect - github.com/richardlehane/msoleps v1.0.3 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/shirou/gopsutil/v3 v3.24.4 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/tklauser/go-sysconf v0.3.14 // indirect github.com/tklauser/numcpus v0.8.0 // indirect - github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect - github.com/xuri/excelize/v2 v2.8.1 // indirect - github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/otel v1.26.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0 // indirect @@ -143,3 +141,5 @@ require ( modernc.org/memory v1.8.0 // indirect modernc.org/sqlite v1.29.8 // indirect ) + +replace github.com/limes-cloud/kratosx v1.0.39 => ../../framework/kratosx diff --git a/go.sum b/go.sum index 0a3a35c..1676ffb 100644 --- a/go.sum +++ b/go.sum @@ -717,8 +717,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/alexflint/go-filemutex v1.2.0/go.mod h1:mYyQSWvw9Tx2/H2n9qXPb52tTYfE0pZAWcBq5mK025c= -github.com/aliyun/aliyun-oss-go-sdk v3.0.1+incompatible h1:so4m5rRA32Tc5GgKg/5gKUu0CRsYmVO3ThMP6T3CwLc= -github.com/aliyun/aliyun-oss-go-sdk v3.0.1+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= +github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible h1:8psS8a+wKfiLt1iVDX79F7Y6wUM49Lcha2FMXt4UM8g= +github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= @@ -747,6 +747,7 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/billcobbler/casbin-redis-watcher/v2 v2.0.0-20211014141847-d29c8619193d h1:YVk4z1FRH7kId4x7MfaR9stVsOMZMBZtdH1xkWFnY6Y= @@ -1103,8 +1104,6 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= -github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= -github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/garyburd/redigo v1.6.4 h1:LFu2R3+ZOPgSMWMOL+saa/zXRjw0ID2G8FepO53BGlg= @@ -1140,6 +1139,8 @@ github.com/go-kratos/aegis v0.2.1-0.20230616030432-99110a3f05f4 h1:LGUYBh6R1CGe1 github.com/go-kratos/aegis v0.2.1-0.20230616030432-99110a3f05f4/go.mod h1:jqdJn8QOoobkmqfhO51kb/qUeHAQ8r0WpjPKl7cP3nQ= github.com/go-kratos/kratos/contrib/log/zap/v2 v2.0.0-20240504101732-d0d5761f9ca8 h1:Qoi9jssHMmgY/bIIT+HWzZcKy/DTktfSZkwdH1Rzp7Y= github.com/go-kratos/kratos/contrib/log/zap/v2 v2.0.0-20240504101732-d0d5761f9ca8/go.mod h1:eD/bSXiReDHdcaE5Mk1RqUCMYpYjEmV39sHxCa/o/II= +github.com/go-kratos/kratos/contrib/metrics/prometheus/v2 v2.0.0-20240322155018-41971ffa647a h1:3hRhRQwrS0ryRyxgr/i1p0FILs9SSbzQ7XaQ6JP+mTE= +github.com/go-kratos/kratos/contrib/metrics/prometheus/v2 v2.0.0-20240322155018-41971ffa647a/go.mod h1:jZUwXef+0aVWFsVRGevBu3Clf7DyaXpiRStfpF4P64U= github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240504101732-d0d5761f9ca8 h1:uTpt/+092FZ0q0JeqGjim5ZConxuZHfTgSxMCuFp4k8= github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240504101732-d0d5761f9ca8/go.mod h1:2dO01eHwztTovqoaig4CT368XQHks2ubQ6YwuR8moIc= github.com/go-kratos/kratos/v2 v2.7.3 h1:T9MS69qk4/HkVUuHw5GS9PDVnOfzn+kxyF0CL5StqxA= @@ -1190,8 +1191,14 @@ github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lY github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/form/v4 v4.2.1 h1:HjdRDKO0fftVMU5epjPW2SOREcZ6/wLUzEobqUGJuPw= github.com/go-playground/form/v4 v4.2.1/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U= +github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= +github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= +github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/go-redsync/redsync/v4 v4.12.1 h1:hCtdZ45DJxMxNdPiby5GlQwOKQmcka2587Y466qPqlA= +github.com/go-redsync/redsync/v4 v4.12.1/go.mod h1:sn72ojgeEhxUuRjrliK0NRrB0Zl6kOZ3BDvNN3P2jAY= github.com/go-resty/resty/v2 v2.12.0 h1:rsVL8P90LFvkUYq/V5BTVe203WfRIU4gvcf+yfzJzGA= github.com/go-resty/resty/v2 v2.12.0/go.mod h1:o0yGPrkS3lOe1+eFajk6kBW8ScXzwU3hD69/gt2yB/0= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -1276,6 +1283,7 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0= +github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -1304,9 +1312,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= github.com/google/go-containerregistry v0.14.0/go.mod h1:aiJ2fp/SXvkWgmYHioXnbMdlgB8eXiiYOY55gfN91Wk= +github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -1380,6 +1387,7 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafov/m3u8 v0.12.0/go.mod h1:nqzOkfBiZJENr52zTVd/Dcl03yzphIMbJqkXGu+u080= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -1556,12 +1564,6 @@ github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmt github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs= github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/limes-cloud/configure v1.0.32 h1:3xspc0rR9d7dUbyF9PyEJcTOZpqxMh+tbDFoqz1VqyM= -github.com/limes-cloud/configure v1.0.32/go.mod h1:rUWafdOaLO2nk1fuhQVRJw6vM7UAOP+QhEyqgw2oow0= -github.com/limes-cloud/kratosx v1.0.31 h1:L9ygmB30i8zo/3ZSZ+qemboAI7jrN3vnc0Wa2H48kvY= -github.com/limes-cloud/kratosx v1.0.31/go.mod h1:xmk+1VUhM/vK7JE1eTPebFIBdiS49KFYN2Hf6g8UVQY= -github.com/limes-cloud/manager v1.0.13 h1:eikvmvZuRzUgoYuE7rsC/5lVcVn5ZpVRFpZjjp1ORZ4= -github.com/limes-cloud/manager v1.0.13/go.mod h1:wv50Xwr4IuNk9UuH5lF546Uyil+83I2MQ6rvf2CIusA= github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lufia/plan9stats v0.0.0-20240408141607-282e7b5d6b74 h1:1KuuSOy4ZNgW0KA2oYIngXVFhQcXxhLqCVK7cBcldkk= @@ -1664,16 +1666,13 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/mojocn/base64Captcha v1.3.6 h1:gZEKu1nsKpttuIAQgWHO+4Mhhls8cAKyiV2Ew03H+Tw= github.com/mojocn/base64Captcha v1.3.6/go.mod h1:i5CtHvm+oMbj1UzEPXaA8IH/xHFZ3DGY3Wh3dBpZ28E= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSrwhe88TQQ= github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60= -github.com/mozillazg/go-httpheader v0.3.1 h1:IRP+HFrMX2SlwY9riuio7raffXUpzAosHtZu25BSJok= -github.com/mozillazg/go-httpheader v0.3.1/go.mod h1:PuT8h0pw6efvp8ZeUec1Rs7dwjK08bt6gKSReGMqtdA= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= @@ -1837,12 +1836,16 @@ github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrb github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -1854,6 +1857,8 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9 github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y= +github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -1867,18 +1872,19 @@ github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rafaeljusto/redigomock v0.0.0-20170720131524-7ae0511314e9 h1:AgFSzGRVSy1kZ8EBHycQc6qK9gVqhJnVI2H/dk2cY/Y= github.com/rafaeljusto/redigomock v0.0.0-20170720131524-7ae0511314e9/go.mod h1:JaY6n2sDr+z2WTsXkOmNRUfDy6FN0L6Nk7x06ndm4tY= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/redis/go-redis/v9 v9.4.0 h1:Yzoz33UZw9I/mFhx4MNrB6Fk+XHO1VukNcCa1+lwyKk= +github.com/redis/go-redis/v9 v9.4.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo= +github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM= -github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk= -github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= -github.com/richardlehane/msoleps v1.0.3 h1:aznSZzrwYRl3rLKRT3gUk9am7T/mLNSnJINvN0AQoVM= -github.com/richardlehane/msoleps v1.0.3/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1989,6 +1995,8 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM= +github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1997,8 +2005,8 @@ github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ github.com/tchap/go-patricia/v2 v2.3.1/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.563/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563/go.mod h1:uom4Nvi9W+Qkom0exYiJ9VWJjXwyxtPYTkKkaLMlfE0= -github.com/tencentyun/cos-go-sdk-v5 v0.7.45 h1:5/ZGOv846tP6+2X7w//8QjLgH2KcUK+HciFbfjWquFU= -github.com/tencentyun/cos-go-sdk-v5 v0.7.45/go.mod h1:DH9US8nB+AJXqwu/AMOrCFN1COv3dpytXuJWHgdg7kE= +github.com/tencentyun/cos-go-sdk-v5 v0.7.49 h1:A3UIV4i+/T2XOfgQnUF9HgoQ6SI8QRz8Dd1F8CLkl4k= +github.com/tencentyun/cos-go-sdk-v5 v0.7.49/go.mod h1:UN+VdbCl1hg+kKi5RXqZgaP+Boqfmk+D04GRc4XFk70= github.com/testcontainers/testcontainers-go v0.25.0/go.mod h1:4sC9SiJyzD1XFi59q8umTQYWxnkweEc5OjVtTUlJzqQ= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= @@ -2046,12 +2054,6 @@ github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d h1:llb0neMWDQe87IzJLS4Ci7psK/lVsjIS2otl+1WyRyY= -github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI= -github.com/xuri/excelize/v2 v2.8.1 h1:pZLMEwK8ep+CLIUWpWmvW8IWE/yxqG0I1xcN6cVMGuQ= -github.com/xuri/excelize/v2 v2.8.1/go.mod h1:oli1E4C3Pa5RXg1TBXn4ENCXDV5JUMlBluUhG7c+CEE= -github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 h1:hPVCafDV85blFTabnqKgNhDCkJX25eik94Si9cTER4A= -github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= github.com/yashtewari/glob-intersection v0.1.0/go.mod h1:LK7pIC3piUjovexikBbJ26Yml7g8xa5bsjfx2v1fwok= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -2067,7 +2069,6 @@ github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= -github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= diff --git a/internal/biz/directory/biz.go b/internal/biz/directory/biz.go new file mode 100755 index 0000000..c2c3100 --- /dev/null +++ b/internal/biz/directory/biz.go @@ -0,0 +1,75 @@ +package directory + +import ( + "github.com/limes-cloud/kratosx" + "github.com/limes-cloud/kratosx/pkg/tree" + "github.com/limes-cloud/resource/api/resource/errors" + "github.com/limes-cloud/resource/internal/conf" +) + +type UseCase struct { + conf *conf.Config + repo Repo +} + +func NewUseCase(config *conf.Config, repo Repo) *UseCase { + return &UseCase{conf: config, repo: repo} +} + +// GetDirectory 获取指定的文件目录信息 +func (u *UseCase) GetDirectory(ctx kratosx.Context, req *GetDirectoryRequest) (*Directory, error) { + var ( + res *Directory + err error + ) + + if req.Id != nil { + res, err = u.repo.GetDirectory(ctx, *req.Id) + } else { + return nil, errors.ParamsError() + } + + if err != nil { + return nil, errors.GetError(err.Error()) + } + return res, nil +} + +// ListDirectory 获取文件目录信息列表树 +func (u *UseCase) ListDirectory(ctx kratosx.Context, req *ListDirectoryRequest) ([]tree.Tree, uint32, error) { + list, total, err := u.repo.ListDirectory(ctx, req) + if err != nil { + return nil, 0, errors.ListError(err.Error()) + } + var ts []tree.Tree + for _, item := range list { + ts = append(ts, item) + } + return tree.BuildArrayTree(ts), total, nil +} + +// CreateDirectory 创建文件目录信息 +func (u *UseCase) CreateDirectory(ctx kratosx.Context, req *Directory) (uint32, error) { + id, err := u.repo.CreateDirectory(ctx, req) + if err != nil { + return 0, errors.CreateError(err.Error()) + } + return id, nil +} + +// UpdateDirectory 更新文件目录信息 +func (u *UseCase) UpdateDirectory(ctx kratosx.Context, req *Directory) error { + if err := u.repo.UpdateDirectory(ctx, req); err != nil { + return errors.UpdateError(err.Error()) + } + return nil +} + +// DeleteDirectory 删除文件目录信息 +func (u *UseCase) DeleteDirectory(ctx kratosx.Context, ids []uint32) (uint32, error) { + total, err := u.repo.DeleteDirectory(ctx, ids) + if err != nil { + return 0, errors.DeleteError(err.Error()) + } + return total, nil +} diff --git a/internal/biz/directory/entity.go b/internal/biz/directory/entity.go new file mode 100755 index 0000000..88d13ef --- /dev/null +++ b/internal/biz/directory/entity.go @@ -0,0 +1,41 @@ +package directory + +import ( + "github.com/limes-cloud/kratosx/pkg/tree" +) + +type Directory struct { + Id uint32 `json:"id"` + ParentId uint32 `json:"parentId"` + Name string `json:"name"` + Accept string `json:"accept"` + MaxSize uint32 `json:"maxSize"` + CreatedAt int64 `json:"createdAt"` + UpdatedAt int64 `json:"updatedAt"` + Children []*Directory `json:"Children"` +} + +// ID 获取菜单树ID +func (m *Directory) ID() uint32 { + return m.Id +} + +// Parent 获取父ID +func (m *Directory) Parent() uint32 { + return m.ParentId +} + +// AppendChildren 添加子节点 +func (m *Directory) AppendChildren(child any) { + menu := child.(*Directory) + m.Children = append(m.Children, menu) +} + +// ChildrenNode 获取子节点 +func (m *Directory) ChildrenNode() []tree.Tree { + var list []tree.Tree + for _, item := range m.Children { + list = append(list, item) + } + return list +} diff --git a/internal/biz/directory/repo.go b/internal/biz/directory/repo.go new file mode 100755 index 0000000..fb32fc9 --- /dev/null +++ b/internal/biz/directory/repo.go @@ -0,0 +1,28 @@ +package directory + +import ( + "github.com/limes-cloud/kratosx" +) + +type Repo interface { + // GetDirectory 获取指定的文件目录信息 + GetDirectory(ctx kratosx.Context, id uint32) (*Directory, error) + + // ListDirectory 获取文件目录信息列表 + ListDirectory(ctx kratosx.Context, req *ListDirectoryRequest) ([]*Directory, uint32, error) + + // CreateDirectory 创建文件目录信息 + CreateDirectory(ctx kratosx.Context, req *Directory) (uint32, error) + + // UpdateDirectory 更新文件目录信息 + UpdateDirectory(ctx kratosx.Context, req *Directory) error + + // DeleteDirectory 删除文件目录信息 + DeleteDirectory(ctx kratosx.Context, ids []uint32) (uint32, error) + + // GetDirectoryParentIds 获取父文件目录信息ID列表 + GetDirectoryParentIds(ctx kratosx.Context, id uint32) ([]uint32, error) + + // GetDirectoryChildrenIds 获取子文件目录信息ID列表 + GetDirectoryChildrenIds(ctx kratosx.Context, id uint32) ([]uint32, error) +} diff --git a/internal/biz/directory/types.go b/internal/biz/directory/types.go new file mode 100755 index 0000000..85e1bca --- /dev/null +++ b/internal/biz/directory/types.go @@ -0,0 +1,10 @@ +package directory + +type GetDirectoryRequest struct { + Id *uint32 `json:"id"` +} + +type ListDirectoryRequest struct { + Order *string `json:"order"` + OrderBy *string `json:"orderBy"` +} diff --git a/internal/biz/export/biz.go b/internal/biz/export/biz.go old mode 100644 new mode 100755 index 13040ab..98deebe --- a/internal/biz/export/biz.go +++ b/internal/biz/export/biz.go @@ -1,179 +1,44 @@ package export import ( - "encoding/json" - "fmt" - "os" - "github.com/limes-cloud/kratosx" - "github.com/limes-cloud/kratosx/pkg/util" - "github.com/limes-cloud/kratosx/types" - "github.com/limes-cloud/manager/api/auth" - "github.com/limes-cloud/resource/api/errors" - "github.com/limes-cloud/resource/internal/biz/file" - "github.com/limes-cloud/resource/internal/config" + "github.com/limes-cloud/resource/api/resource/errors" + "github.com/limes-cloud/resource/internal/conf" ) type UseCase struct { - config *config.Config - repo Repo - fileRepo file.Repo - factory Factory + conf *conf.Config + repo Repo } -func NewUseCase(config *config.Config, repo Repo, factory Factory) *UseCase { - return &UseCase{config: config, repo: repo, factory: factory} +func NewUseCase(config *conf.Config, repo Repo) *UseCase { + return &UseCase{conf: config, repo: repo} } -func (u *UseCase) PageExport(ctx kratosx.Context, in *PageExportRequest) ([]*Export, uint32, error) { - info, err := auth.Get(ctx) - if err != nil { - return nil, 0, err - } - in.UserId = info.UserId - - list, total, err := u.repo.PageExport(ctx, in) +// ListExport 获取导出信息列表 +func (u *UseCase) ListExport(ctx kratosx.Context, req *ListExportRequest) ([]*Export, uint32, error) { + list, total, err := u.repo.ListExport(ctx, req) if err != nil { - return nil, 0, errors.Database() - } - for ind, item := range list { - list[ind].Src = u.factory.ExportFileSrc(item.Src) + return nil, 0, errors.ListError(err.Error()) } return list, total, nil } -func (u *UseCase) DeleteExport(ctx kratosx.Context, id uint32) error { - info, err := auth.Get(ctx) - if err != nil { - return err - } - exp, err := u.repo.GetExport(ctx, id) +// CreateExport 创建导出信息 +func (u *UseCase) CreateExport(ctx kratosx.Context, req *Export) (uint32, error) { + id, err := u.repo.CreateExport(ctx, req) if err != nil { - return errors.NotFound() + return 0, errors.CreateError(err.Error()) } - if err := u.repo.DeleteExport(ctx, info.UserId, id); err != nil { - return errors.Database() - } - _ = os.Remove(u.config.Export.LocalDir + exp.Src) - return nil -} - -func (u *UseCase) AddExport(ctx kratosx.Context, in *AddExportRequest) (uint32, error) { - info, err := auth.Get(ctx) - if err != nil { - return 0, err - } - - b, _ := json.Marshal(in) - version := util.MD5(b) - - exp, err := u.repo.GetExportByVersion(ctx, info.UserId, version) - src := fmt.Sprintf("%s.zip", version) - var id uint32 - if err == nil { - if exp.Status == StatusProcess { - return 0, errors.ExportTaskProcess() - } - if exp.Status == StatusFinish { - return exp.ID, nil - } - exp.Status = StatusProcess - if err := u.repo.UpdateExport(ctx, exp); err != nil { - ctx.Logger().Errorw("msg", "update export status error", "err", err.Error()) - } - id = exp.ID - } else { - id, err = u.repo.AddExport(ctx, &Export{ - UserId: info.UserId, - Src: src, - Name: in.Name, - Version: version, - Status: StatusProcess, - }) - if err != nil { - return 0, errors.DatabaseFormat(err.Error()) - } - } - - in.Name = u.config.Export.LocalDir + "/" + src - go func() { - kCtx := ctx.Clone() - size, err := u.factory.ExportFile(kCtx, in) - exp := &Export{ - BaseModel: types.BaseModel{ID: id}, - Status: StatusFinish, - Size: uint32(size), - Version: version, - } - if err != nil { - exp.Status = StatusFail - exp.Reason = err.Error() - } - - if err := u.repo.UpdateExport(kCtx, exp); err != nil { - ctx.Logger().Errorw("msg", "update export status error", "err", err.Error()) - } - }() - return id, nil } -func (u *UseCase) AddExportExcel(ctx kratosx.Context, in *AddExportExcelRequest) (uint32, error) { - info, err := auth.Get(ctx) +// DeleteExport 删除导出信息 +func (u *UseCase) DeleteExport(ctx kratosx.Context, ids []uint32) (uint32, error) { + total, err := u.repo.DeleteExport(ctx, ids) if err != nil { - return 0, err - } - - b, _ := json.Marshal(in) - version := util.MD5(b) - - exp, err := u.repo.GetExportByVersion(ctx, info.UserId, version) - src := fmt.Sprintf("%s.xlsx", version) - var id uint32 - if err == nil { - if exp.Status == StatusProcess { - return 0, errors.ExportTaskProcess() - } - if exp.Status == StatusFinish { - return exp.ID, nil - } - exp.Status = StatusProcess - if err := u.repo.UpdateExport(ctx, exp); err != nil { - ctx.Logger().Errorw("msg", "update export status error", "err", err.Error()) - } - id = exp.ID - } else { - id, err = u.repo.AddExport(ctx, &Export{ - UserId: info.UserId, - Src: src, - Name: in.Name, - Version: version, - Status: StatusProcess, - }) - if err != nil { - return 0, errors.DatabaseFormat(err.Error()) - } + return 0, errors.DeleteError(err.Error()) } - - in.Name = u.config.Export.LocalDir + "/" + src - go func() { - kCtx := ctx.Clone() - size, err := u.factory.ExportExcel(kCtx, in) - exp := &Export{ - BaseModel: types.BaseModel{ID: id}, - Status: StatusFinish, - Size: uint32(size), - } - if err != nil { - exp.Status = StatusFail - exp.Reason = err.Error() - } - - if err := u.repo.UpdateExport(kCtx, exp); err != nil { - ctx.Logger().Errorw("msg", "update export status error", "err", err.Error()) - } - }() - - return id, nil + return total, nil } diff --git a/internal/biz/export/biz_test.go b/internal/biz/export/biz_test.go deleted file mode 100644 index 0fd21d2..0000000 --- a/internal/biz/export/biz_test.go +++ /dev/null @@ -1 +0,0 @@ -package export diff --git a/internal/biz/export/entity.go b/internal/biz/export/entity.go old mode 100644 new mode 100755 index d48f3bd..e037925 --- a/internal/biz/export/entity.go +++ b/internal/biz/export/entity.go @@ -1,21 +1,17 @@ package export -import "github.com/limes-cloud/kratosx/types" - -const ( - StatusProcess = "process" - StatusFinish = "finish" - StatusFail = "fail" - StatusExpire = "expire" -) - type Export struct { - types.BaseModel - UserId uint32 `json:"user_id"` - Name string `json:"name"` - Size uint32 `json:"size"` - Src string `json:"src"` - Version string `json:"version"` - Reason string `json:"reason"` - Status string `json:"status"` + Id uint32 `json:"id"` + UserId uint32 `json:"userId"` + DepartmentId uint32 `json:"departmentId"` + Scene string `json:"scene"` + Name string `json:"name"` + Size uint32 `json:"size"` + Sha *string `json:"sha"` + Src *string `json:"src"` + Status string `json:"status"` + Reason *string `json:"reason"` + ExpiredAt int64 `json:"expiredAt"` + CreatedAt int64 `json:"createdAt"` + UpdatedAt int64 `json:"updatedAt"` } diff --git a/internal/biz/export/factory.go b/internal/biz/export/factory.go deleted file mode 100644 index d5f69fc..0000000 --- a/internal/biz/export/factory.go +++ /dev/null @@ -1,11 +0,0 @@ -package export - -import ( - "github.com/limes-cloud/kratosx" -) - -type Factory interface { - ExportFileSrc(src string) string - ExportFile(ctx kratosx.Context, in *AddExportRequest) (int64, error) - ExportExcel(ctx kratosx.Context, in *AddExportExcelRequest) (int64, error) -} diff --git a/internal/biz/export/repo.go b/internal/biz/export/repo.go old mode 100644 new mode 100755 index 85d6657..baf703a --- a/internal/biz/export/repo.go +++ b/internal/biz/export/repo.go @@ -5,11 +5,12 @@ import ( ) type Repo interface { - PageExport(ctx kratosx.Context, req *PageExportRequest) ([]*Export, uint32, error) - AddExport(ctx kratosx.Context, c *Export) (uint32, error) - GetExportByVersion(ctx kratosx.Context, uid uint32, version string) (*Export, error) - GetExport(ctx kratosx.Context, id uint32) (*Export, error) - UpdateExport(ctx kratosx.Context, c *Export) error - DeleteExport(ctx kratosx.Context, uid, id uint32) error - UpdateExportExpire(ctx kratosx.Context, t int64) error + // ListExport 获取导出信息列表 + ListExport(ctx kratosx.Context, req *ListExportRequest) ([]*Export, uint32, error) + + // CreateExport 创建导出信息 + CreateExport(ctx kratosx.Context, req *Export) (uint32, error) + + // DeleteExport 删除导出信息 + DeleteExport(ctx kratosx.Context, ids []uint32) (uint32, error) } diff --git a/internal/biz/export/types.go b/internal/biz/export/types.go old mode 100644 new mode 100755 index 60b912f..0880d32 --- a/internal/biz/export/types.go +++ b/internal/biz/export/types.go @@ -1,28 +1,10 @@ package export -type PageExportRequest struct { - Page uint32 `json:"page"` - PageSize uint32 `json:"page_size"` - UserId uint32 `json:"user_id"` -} - -type ExportFile struct { - Sha string `json:"sha"` - Rename string `json:"rename"` -} - -type ExportExcel struct { - Type string `json:"type"` - Value string `json:"value"` -} - -type AddExportRequest struct { - Name string `json:"name"` - Files []*ExportFile `json:"files"` - Ids []uint32 `json:"ids"` -} - -type AddExportExcelRequest struct { - Name string `json:"name"` - Rows [][]*ExportExcel `json:"rows"` +type ListExportRequest struct { + Page uint32 `json:"page"` + PageSize uint32 `json:"pageSize"` + Order *string `json:"order"` + OrderBy *string `json:"orderBy"` + UserId *uint32 `json:"userId"` + DepartmentId *uint32 `json:"departmentId"` } diff --git a/internal/biz/file/biz.go b/internal/biz/file/biz.go old mode 100644 new mode 100755 index f5a23ee..ac8f5b4 --- a/internal/biz/file/biz.go +++ b/internal/biz/file/biz.go @@ -1,350 +1,259 @@ package file import ( - "bytes" - "io" - "mime" - "os" - "path/filepath" + oe "errors" + "fmt" + "math" "strings" "sync" + "time" - "github.com/golang/protobuf/proto" "github.com/google/uuid" "github.com/limes-cloud/kratosx" + "github.com/limes-cloud/kratosx/pkg/valx" + "google.golang.org/protobuf/proto" + "gorm.io/gorm" - "github.com/limes-cloud/resource/api/errors" - "github.com/limes-cloud/resource/internal/config" - "github.com/limes-cloud/resource/internal/consts" - "github.com/limes-cloud/resource/internal/pkg/image" + "github.com/limes-cloud/resource/api/resource/errors" + "github.com/limes-cloud/resource/internal/conf" + "github.com/limes-cloud/resource/internal/pkg/util" ) type UseCase struct { - config *config.Config - repo Repo - factory Factory - muiOnce map[string]*sync.Once - rw sync.RWMutex + conf *conf.Config + repo Repo + rw sync.RWMutex + mui map[string]*sync.Once } -func NewUseCase(config *config.Config, repo Repo, factory Factory) *UseCase { - return &UseCase{config: config, repo: repo, factory: factory, muiOnce: make(map[string]*sync.Once)} +func NewUseCase(config *conf.Config, repo Repo) *UseCase { + return &UseCase{conf: config, repo: repo, mui: make(map[string]*sync.Once), rw: sync.RWMutex{}} } -func (u *UseCase) AllDirectoryByParentID(ctx kratosx.Context, pid uint32, app string) ([]*Directory, error) { - list, err := u.repo.AllDirectoryByParentID(ctx, pid, app) - if err != nil { - return nil, errors.Database() - } - return list, nil -} - -func (u *UseCase) AddDirectory(ctx kratosx.Context, in *Directory) (uint32, error) { - if in.ParentID != 0 { - directory, err := u.repo.GetDirectoryByID(ctx, in.ParentID) - if err != nil { - return 0, errors.NotExistDirectory() - } - if directory.App != in.App { - return 0, errors.System() - } - } - id, err := u.repo.AddDirectory(ctx, in) - if err != nil { - return 0, errors.DatabaseFormat(err.Error()) - } - return id, nil -} - -func (u *UseCase) UpdateDirectory(ctx kratosx.Context, in *Directory) error { - directory, err := u.repo.GetDirectoryByID(ctx, in.ID) - if err != nil { - return errors.NotExistDirectory() - } - if directory.App != in.App { - return errors.System() - } - - if err := u.repo.UpdateDirectory(ctx, in); err != nil { - return errors.DatabaseFormat(err.Error()) - } - return nil -} - -func (u *UseCase) DeleteDirectory(ctx kratosx.Context, id uint32, app string) error { - directory, err := u.repo.GetDirectoryByID(ctx, id) - if err != nil { - return errors.NotExistDirectory() - } - if directory.App != app { - return errors.System() - } - - // 是否存在文件 - if count, _ := u.repo.FileCountByDirectoryID(ctx, id); count != 0 { - return errors.DeleteDirectoryFormat("当前目录下存在文件或目录") - } - - // 判断是否存在目录 - if count, _ := u.repo.DirectoryCountByParentID(ctx, id); count != 0 { - return errors.DeleteDirectoryFormat("当前目录下存在文件或目录") - } - - if err := u.repo.DeleteDirectory(ctx, id); err != nil { - return errors.Database() - } - return nil -} - -func (u *UseCase) GetFile(ctx kratosx.Context, in *GetFileRequest) (*GetFileResponse, error) { - store, err := u.factory.Store(ctx) - if err != nil { - return nil, errors.System() - } - reader, err := store.Get(in.Src) - if err != nil { - return nil, errors.NotExistResource() - } - - var rb []byte - if in.IsRange { - file := reader.(*os.File) - if _, err := file.Seek(in.Start, io.SeekStart); err != nil { - return nil, errors.AccessResourceFormat(err.Error()) - } - tempReader := bytes.NewBuffer([]byte{}) - if _, err := io.CopyN(tempReader, file, in.End-in.Start+1); err != nil { - return nil, errors.AccessResourceFormat(err.Error()) - } - rb, _ = io.ReadAll(tempReader) +// GetFile 获取指定的文件信息 +func (u *UseCase) GetFile(ctx kratosx.Context, req *GetFileRequest) (*File, error) { + var ( + res *File + err error + ) + + if req.Id != nil { + res, err = u.repo.GetFile(ctx, *req.Id) + } else if req.Sha != nil { + res, err = u.repo.GetFileBySha(ctx, *req.Sha) } else { - rb, _ = io.ReadAll(reader) + return nil, errors.ParamsError() } - fileMime := mime.TypeByExtension(filepath.Ext(in.Src)) - if fileMime == "" { - fileMime = u.factory.FileMime(rb) - } - // 如果是图片,则进行裁剪 - if strings.Contains(fileMime, "image/") && in.Width > 0 && in.Height > 0 { - tp := strings.Split(fileMime, "/")[1] - if img, err := image.New(tp, rb); err == nil { - if in.Mode == "" { - in.Mode = image.AspectFill - } - if nrb, err := img.Resize(in.Width, in.Height, in.Mode); err == nil { - rb = nrb - } - } + if res.Status != STATUS_COMPLETED { + return nil, errors.NotExistFileError() } - return &GetFileResponse{ - Data: rb, - Mime: fileMime, - }, nil -} - -func (u *UseCase) GetFileBySha(ctx kratosx.Context, sha string) (*File, error) { - file, err := u.repo.GetFileBySha(ctx, sha) if err != nil { - return nil, err + return nil, errors.NotExistFileError(err.Error()) } - file.Src = u.factory.FileSrc(file.Src) - return file, nil + return res, nil } -func (u *UseCase) PageFile(ctx kratosx.Context, in *PageFileRequest) ([]*File, uint32, error) { - list, total, err := u.repo.PageFile(ctx, in) +// ListFile 获取文件信息列表 +func (u *UseCase) ListFile(ctx kratosx.Context, req *ListFileRequest) ([]*File, uint32, error) { + list, total, err := u.repo.ListFile(ctx, req) if err != nil { - return nil, 0, errors.DatabaseFormat(err.Error()) - } - for ind, item := range list { - list[ind].Src = u.factory.FileSrc(item.Src) + return nil, 0, errors.ListError(err.Error()) } return list, total, nil } -// UpdateFile 修改文件名称 -func (u *UseCase) UpdateFile(ctx kratosx.Context, file *File) error { - if err := u.repo.UpdateFile(ctx, file); err != nil { - return errors.DatabaseFormat(err.Error()) - } - return nil -} - -// DeleteFiles 删除文件 -func (u *UseCase) DeleteFiles(ctx kratosx.Context, pid uint32, ids []uint32) error { - if err := u.repo.DeleteFiles(ctx, pid, ids); err != nil { - return errors.DatabaseFormat(err.Error()) - } - return nil -} - -// PrepareUploadFile 预上传文件 -func (u *UseCase) PrepareUploadFile(ctx kratosx.Context, in *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) { - if in.DirectoryPath == "" && in.DirectoryId == 0 { - return nil, errors.Params() - } - - var err error - var directory *Directory - if in.DirectoryPath != "" { - paths := strings.Split(in.DirectoryPath, "/") - directory, err = u.repo.GetDirectoryByPaths(ctx, in.App, paths) +// PrepareUploadFile 预上传文件信息 +func (u *UseCase) PrepareUploadFile(ctx kratosx.Context, req *PrepareUploadFileRequest) (*PrepareUploadFileReply, error) { + var ( + err error + limit *DirectoryLimit + directoryId uint32 + ) + if req.DirectoryId != nil { + limit, err = u.repo.GetDirectoryLimitById(ctx, *req.DirectoryId) } else { - directory, err = u.repo.GetDirectoryByID(ctx, in.DirectoryId) + paths := strings.Split(*req.DirectoryPath, "/") + limit, err = u.repo.GetDirectoryLimitByPath(ctx, paths) } if err != nil { - return nil, errors.DatabaseFormat(err.Error()) + return nil, errors.DatabaseError(err.Error()) } + directoryId = limit.DirectoryId + chunkSize := util.GetKBSize(u.conf.ChunkSize) - file, err := u.repo.GetFileBySha(ctx, in.Sha) + // 校验是否存在上传记录 + oldFile, err := u.repo.GetFileBySha(ctx, req.Sha) + if err != nil && !oe.Is(err, gorm.ErrRecordNotFound) { + return nil, errors.UpdateError(err.Error()) + } if err == nil { // 触发秒传 - if file.Status == consts.STATUS_COMPLETED { - _ = u.repo.CopyFile(ctx, file, directory.ID, in.Name) + if oldFile.Status == STATUS_COMPLETED { + if err := u.repo.CopyFile(ctx, oldFile, directoryId, req.Name); err != nil { + return nil, errors.UploadFileError(err.Error()) + } return &PrepareUploadFileReply{ - Uploaded: proto.Bool(true), - Src: proto.String(u.factory.FileSrc(file.Src)), - Sha: proto.String(file.Sha), + Uploaded: true, + Src: proto.String(oldFile.Src), + Sha: proto.String(oldFile.Sha), + URL: proto.String(oldFile.URL), }, nil } - - var chunks []int - if file.ChunkCount > 1 && file.UploadID != nil { - store, err := u.factory.Store(ctx) - if err != nil { - return nil, errors.InitStoreFormat(err.Error()) - } - chunk, err := store.NewPutChunkByUploadID(file.Src, *file.UploadID) - if err != nil { - return nil, errors.ChunkUpload() - } - chunks = chunk.UploadedChunkIndex() + // 触发断点续传 + chunkFactory, err := u.repo.GetStore().NewPutChunkByUploadID(oldFile.Sha, oldFile.UploadId) + if err != nil { + ctx.Logger().Warnf("get upload chunks error:%s", err.Error()) } return &PrepareUploadFileReply{ - Uploaded: proto.Bool(false), - UploadId: file.UploadID, - ChunkSize: proto.Uint32(uint32(u.factory.MaxChunkSize())), - ChunkCount: proto.Uint32(file.ChunkCount), - UploadChunks: chunks, - Sha: proto.String(file.Sha), + Uploaded: false, + UploadId: proto.String(oldFile.UploadId), + ChunkSize: proto.Uint32(chunkSize), + ChunkCount: proto.Uint32(oldFile.ChunkCount), + UploadChunks: chunkFactory.UploadedChunkIndex(), + Sha: proto.String(oldFile.Sha), }, nil } - // 检查文件大小 - if err := u.factory.CheckSize(int64(in.Size)); err != nil { - return nil, err + // 校验文件大小 + if size := util.GetKBSize(limit.MaxSize); size < req.Size { + return nil, errors.ExceedMaxSizeError() } - // 获取文件类型 - fileType := u.factory.GetType(in.Name) - - // 检查文件后缀 - if err := u.factory.CheckType(fileType); err != nil { - return nil, err + // 校验文件类型 + tp := util.GetFileType(req.Name) + if !valx.InList(limit.Accepts, tp) { + return nil, errors.NoSupportFileTypeError() } // 构建文件对象 - file = &File{ - DirectoryID: directory.ID, - Size: in.Size, - Sha: in.Sha, - Name: in.Name, - Src: u.factory.StoreKey(in.Sha, fileType), - Status: consts.STATUS_PROGRESS, - Storage: u.factory.Storage(), - Type: fileType, - UploadID: proto.String(uuid.NewString()), + file := &File{ + DirectoryId: directoryId, + Size: req.Size, + Sha: req.Sha, + Name: req.Name, + Src: fmt.Sprintf("%s.%s", req.Sha, tp), + Status: STATUS_PROGRESS, + Type: tp, + UploadId: uuid.NewString(), ChunkCount: 1, } // 判断是否需要切片 - if u.factory.MaxSingularSize() < int64(in.Size) { - store, err := u.factory.Store(ctx) - if err != nil { - return nil, err - } - - pc, err := store.NewPutChunk(file.Src) + if chunkSize < req.Size { + file.ChunkCount = uint32(math.Ceil(float64(req.Size) / float64(chunkSize))) + chunkFactory, err := u.repo.GetStore().NewPutChunk(file.Src) if err != nil { - return nil, errors.ChunkUpload() + return nil, errors.UpdateError(err.Error()) } - file.UploadID = proto.String(pc.UploadID()) - file.ChunkCount = uint32(u.factory.ChunkCount(int64(in.Size))) + file.UploadId = chunkFactory.UploadID() } - if err := u.repo.AddFile(ctx, file); err != nil { - return nil, errors.Database() + if _, err = u.repo.CreateFile(ctx, file); err != nil { + return nil, errors.UpdateError(err.Error()) } return &PrepareUploadFileReply{ - Uploaded: proto.Bool(false), - UploadId: file.UploadID, - ChunkSize: proto.Uint32(uint32(u.factory.MaxChunkSize())), + Uploaded: false, + UploadId: proto.String(file.UploadId), + ChunkSize: proto.Uint32(chunkSize), ChunkCount: proto.Uint32(file.ChunkCount), - UploadChunks: []int{}, + UploadChunks: nil, }, nil } -func (u *UseCase) UploadFile(ctx kratosx.Context, in *UploadFileRequest) (*UploadFileReply, error) { - file, err := u.repo.GetFileByUploadID(ctx, in.UploadId) +// UploadFile 上传文件信息 +func (u *UseCase) UploadFile(ctx kratosx.Context, req *UploadFileRequest) (*UploadFileReply, error) { + file, err := u.repo.GetFileByUploadId(ctx, req.UploadId) if err != nil { - return nil, errors.UploadFileFormat("上传id不存在") + return nil, errors.UpdateError("不存在上传任务") } - if file.Status == consts.STATUS_COMPLETED { - return nil, errors.UploadFileFormat("请勿重复上传") + if file.Status == STATUS_COMPLETED { + return nil, errors.UpdateError("请勿重复上传") } - store, err := u.factory.Store(ctx) if err != nil { - return nil, err + return nil, errors.UpdateError(err.Error()) } // 直接上传 if file.ChunkCount == 1 { - if err := store.PutBytes(file.Src, in.Data); err != nil { - return nil, errors.UploadFileFormat(err.Error()) + if err = u.repo.GetStore().PutBytes(file.Src, req.Data); err != nil { + return nil, err } - if err := u.repo.UpdateFileSuccess(ctx, file.ID); err != nil { - return nil, errors.UploadFileFormat(err.Error()) + if err = u.repo.UpdateFileStatus(ctx, file.Id, STATUS_COMPLETED); err != nil { + return nil, errors.UploadFileError(err.Error()) } - return &UploadFileReply{ - Src: u.factory.FileSrc(file.Src), - Sha: file.Sha, - }, nil - } + } else { + chunkFactory, err := u.repo.GetStore().NewPutChunkByUploadID(file.Src, req.UploadId) + if err != nil { + return nil, errors.UpdateError(err.Error()) + } + if err = chunkFactory.AppendBytes(req.Data, int(req.Index)); err != nil { + return nil, err + } + u.rw.Lock() + if u.mui[req.UploadId] == nil { + u.mui[req.UploadId] = &sync.Once{} + } + u.rw.Unlock() + + // 当前已经上传完成 + if chunkFactory.ChunkCount() == int(file.ChunkCount) { + u.rw.RLock() + if u.mui[req.UploadId] != nil { + var cErr error + u.mui[req.UploadId].Do(func() { + if err := chunkFactory.Complete(); err != nil { + cErr = err + return + } + if err := u.repo.UpdateFileStatus(ctx, file.Id, STATUS_COMPLETED); err != nil { + cErr = err + } + go func() { + time.Sleep(10 * time.Second) + delete(u.mui, req.UploadId) + }() + }) + if cErr != nil { + return nil, errors.UpdateError(err.Error()) + } + } - // 切片上传 - chunk, err := store.NewPutChunkByUploadID(file.Src, in.UploadId) - if err != nil { - return nil, errors.ChunkUploadFormat(err.Error()) + u.rw.RUnlock() + } } - if err := chunk.AppendBytes(in.Data, int(in.Index)); err != nil { - return nil, errors.ChunkUploadFormat(err.Error()) - } + return &UploadFileReply{ + Src: file.Src, + Sha: file.Sha, + URL: file.URL, + }, nil +} - u.rw.Lock() - if u.muiOnce[in.UploadId] == nil { - u.muiOnce[in.UploadId] = &sync.Once{} +// UpdateFile 更新文件信息 +func (u *UseCase) UpdateFile(ctx kratosx.Context, req *File) error { + if err := u.repo.UpdateFile(ctx, req); err != nil { + return errors.UpdateError(err.Error()) } - u.rw.Unlock() + return nil +} - if chunk.ChunkCount() == int(file.ChunkCount) { - u.rw.RLock() - if u.muiOnce[in.UploadId] != nil { - u.muiOnce[in.UploadId].Do(func() { - _ = chunk.Complete() - _ = u.repo.UpdateFileSuccess(ctx, file.ID) - }) - } - delete(u.muiOnce, in.UploadId) - u.rw.RUnlock() +// DeleteFile 删除文件信息 +func (u *UseCase) DeleteFile(ctx kratosx.Context, ids []uint32) (uint32, error) { + total, err := u.repo.DeleteFile(ctx, ids) + if err != nil { + return 0, errors.DeleteError(err.Error()) } + return total, nil +} - return &UploadFileReply{ - Src: u.factory.FileSrc(file.Src), - Sha: file.Sha, - }, nil +// VerifyURL 验证访问url +func (u *UseCase) VerifyURL(key string, expire string, sign string) error { + if err := u.repo.GetStore().VerifyTemporaryURL(key, expire, sign); err != nil { + return errors.VerifySignError(err.Error()) + } + return nil } diff --git a/internal/biz/file/biz_test.go b/internal/biz/file/biz_test.go deleted file mode 100644 index b691ba5..0000000 --- a/internal/biz/file/biz_test.go +++ /dev/null @@ -1 +0,0 @@ -package file diff --git a/internal/biz/file/const.go b/internal/biz/file/const.go new file mode 100644 index 0000000..ea01057 --- /dev/null +++ b/internal/biz/file/const.go @@ -0,0 +1,6 @@ +package file + +const ( + STATUS_PROGRESS = "PROGRESS" + STATUS_COMPLETED = "COMPLETED" +) diff --git a/internal/biz/file/entity.go b/internal/biz/file/entity.go old mode 100644 new mode 100755 index 4800e8d..9e4ae3e --- a/internal/biz/file/entity.go +++ b/internal/biz/file/entity.go @@ -1,25 +1,23 @@ package file -import "github.com/limes-cloud/kratosx/types" - -type Directory struct { - types.BaseModel - ParentID uint32 `json:"parent_id"` - Name string `json:"name"` - App string `json:"app"` +type File struct { + Id uint32 `json:"id"` + DirectoryId uint32 `json:"directoryId"` + Name string `json:"name"` + Type string `json:"type"` + Size uint32 `json:"size"` + Sha string `json:"sha"` + Src string `json:"src"` + URL string `json:"url"` + Status string `json:"status"` + UploadId string `json:"uploadId"` + ChunkCount uint32 `json:"chunkCount"` + CreatedAt int64 `json:"createdAt"` + UpdatedAt int64 `json:"updatedAt"` } -type File struct { - types.BaseModel - DirectoryID uint32 `json:"directory_id"` - Name string `json:"name"` - Type string `json:"type"` - Size uint32 `json:"size"` - Sha string `json:"sha"` - Src string `json:"src"` - UploadID *string `json:"upload_id"` - ChunkCount uint32 `json:"chunk_count"` - Storage string `json:"storage"` - Status string `json:"status"` - Directory *Directory `json:"directory"` +type DirectoryLimit struct { + DirectoryId uint32 `json:"directoryId"` + Accepts []string `json:"accepts"` + MaxSize uint32 `json:"maxSize"` } diff --git a/internal/biz/file/factory.go b/internal/biz/file/factory.go deleted file mode 100644 index 039e7b9..0000000 --- a/internal/biz/file/factory.go +++ /dev/null @@ -1,22 +0,0 @@ -package file - -import ( - "github.com/limes-cloud/kratosx" - - "github.com/limes-cloud/resource/internal/pkg/store" -) - -type Factory interface { - Storage() string - ChunkCount(size int64) int - GetType(name string) string - StoreKey(sha string, tp string) string - CheckType(tp string) error - CheckSize(size int64) error - MaxSingularSize() int64 - MaxChunkSize() int64 - FileSrcFormat() string - FileSrc(src string) string - FileMime(body []byte) string - Store(ctx kratosx.Context) (store.Store, error) -} diff --git a/internal/biz/file/repo.go b/internal/biz/file/repo.go old mode 100644 new mode 100755 index 92c6007..9635181 --- a/internal/biz/file/repo.go +++ b/internal/biz/file/repo.go @@ -2,30 +2,44 @@ package file import ( "github.com/limes-cloud/kratosx" + + "github.com/limes-cloud/resource/internal/pkg/store" ) type Repo interface { - AddDirectory(ctx kratosx.Context, in *Directory) (uint32, error) - GetDirectoryByID(ctx kratosx.Context, id uint32) (*Directory, error) - GetDirectoryByName(ctx kratosx.Context, id uint32, name string) (*Directory, error) - GetDirectoryByPaths(ctx kratosx.Context, app string, paths []string) (*Directory, error) - UpdateDirectory(ctx kratosx.Context, in *Directory) error - DeleteDirectory(ctx kratosx.Context, id uint32) error - AllDirectoryByParentID(ctx kratosx.Context, pid uint32, app string) ([]*Directory, error) - DirectoryCountByParentID(ctx kratosx.Context, id uint32) (int64, error) - - CopyFile(ctx kratosx.Context, src *File, did uint32, name string) error - - // FileCountByName(ctx kratosx.Context, did uint32, name string) (int64, error) - FileCountByDirectoryID(ctx kratosx.Context, id uint32) (int64, error) - - GetFileByID(ctx kratosx.Context, id uint32) (*File, error) - GetFileBySha(ctx kratosx.Context, keyword string) (*File, error) - GetFileByUploadID(ctx kratosx.Context, uid string) (*File, error) - PageFile(ctx kratosx.Context, req *PageFileRequest) ([]*File, uint32, error) - AddFile(ctx kratosx.Context, c *File) error - UpdateFile(ctx kratosx.Context, file *File) error - UpdateFileSuccess(ctx kratosx.Context, id uint32) error - DeleteFile(ctx kratosx.Context, id uint32) error - DeleteFiles(ctx kratosx.Context, pid uint32, ids []uint32) error + // GetFile 获取指定的文件信息 + GetFile(ctx kratosx.Context, id uint32) (*File, error) + + // ListFile 获取文件信息列表 + ListFile(ctx kratosx.Context, req *ListFileRequest) ([]*File, uint32, error) + + // CreateFile 创建文件信息 + CreateFile(ctx kratosx.Context, req *File) (uint32, error) + + // CopyFile 复制文件信息 + CopyFile(ctx kratosx.Context, src *File, directoryId uint32, fileName string) error + + // UpdateFile 更新文件信息 + UpdateFile(ctx kratosx.Context, req *File) error + + // UpdateFileStatus 更新文 件状态 + UpdateFileStatus(ctx kratosx.Context, id uint32, status string) error + + // DeleteFile 删除文件信息 + DeleteFile(ctx kratosx.Context, ids []uint32) (uint32, error) + + // GetFileBySha 获取指定的文件信息 + GetFileBySha(ctx kratosx.Context, sha string) (*File, error) + + // GetFileByUploadId 获取指定的文件信息 + GetFileByUploadId(ctx kratosx.Context, uid string) (*File, error) + + // GetDirectoryLimitByPath 获取指定的path上传限制信息 + GetDirectoryLimitByPath(ctx kratosx.Context, paths []string) (*DirectoryLimit, error) + + // GetDirectoryLimitById 获取指定的id上传限制信息 + GetDirectoryLimitById(ctx kratosx.Context, id uint32) (*DirectoryLimit, error) + + // GetStore 获取上传器 + GetStore() store.Store } diff --git a/internal/biz/file/types.go b/internal/biz/file/types.go old mode 100644 new mode 100755 index b8064c0..f5269f1 --- a/internal/biz/file/types.go +++ b/internal/biz/file/types.go @@ -1,58 +1,46 @@ package file -type PageFileRequest struct { - Page uint32 `json:"page"` - PageSize uint32 `json:"page_size"` - Name string `json:"name"` - DirectoryId uint32 `json:"directory_id"` +type GetFileRequest struct { + Id *uint32 `json:"id"` + Sha *string `json:"sha"` } -type GetDirectoryByAppRequest struct { - App string `json:"app"` - ParentID uint32 `json:"parent_id"` +type ListFileRequest struct { + Page uint32 `json:"page"` + PageSize uint32 `json:"pageSize"` + Order *string `json:"order"` + OrderBy *string `json:"orderBy"` + DirectoryId *uint32 `json:"directoryId"` + Status *string `json:"status"` } type PrepareUploadFileRequest struct { - DirectoryId uint32 `json:"directory_id"` - DirectoryPath string `json:"directory_path"` - App string `json:"app"` - Name string `json:"name"` - Sha string `json:"sha"` - Size uint32 `json:"size"` + DirectoryId *uint32 `json:"directoryId"` + DirectoryPath *string `json:"directoryPath"` + Name string `json:"name"` + Size uint32 `json:"size"` + Sha string `json:"sha"` } type PrepareUploadFileReply struct { - Uploaded *bool `json:"uploaded"` - Src *string `json:"src"` - ChunkSize *uint32 `json:"chunk_size"` - ChunkCount *uint32 `json:"chunk_count"` - UploadId *string `json:"upload_id"` - UploadChunks []int `json:"upload_chunks"` - Sha *string `json:"sha"` + Uploaded bool `json:"uploaded"` + Src *string `json:"src"` + ChunkSize *uint32 `json:"chunkSize"` + ChunkCount *uint32 `json:"chunkCount"` + UploadId *string `json:"uploadId"` + UploadChunks []uint32 `json:"uploadChunks"` + Sha *string `json:"sha"` + URL *string `json:"url"` } type UploadFileRequest struct { Data []byte `json:"data"` - UploadId string `json:"upload_id"` + UploadId string `json:"uploadId"` Index uint32 `json:"index"` } type UploadFileReply struct { - Src string - Sha string -} - -type GetFileRequest struct { - Src string `json:"src"` - Width int `json:"width"` - Height int `json:"height"` - Mode string `json:"mode"` - IsRange bool `json:"is_range"` - Start int64 `json:"start"` - End int64 `json:"end"` -} - -type GetFileResponse struct { - Data []byte `json:"data"` - Mime string `json:"mime"` + Src string `json:"src"` + Sha string `json:"sha"` + URL string `json:"url"` } diff --git a/internal/conf/conf.go b/internal/conf/conf.go new file mode 100644 index 0000000..dc3b77e --- /dev/null +++ b/internal/conf/conf.go @@ -0,0 +1,27 @@ +package conf + +import "time" + +type Config struct { + // Secret string + // Expire time.Duration + DefaultMaxSize uint32 + + DefaultAcceptTypes []string + ChunkSize uint32 + Export struct { + LocalDir string + Expire time.Duration + } + Storage struct { + Type string + Endpoint string + Id string + Secret string + Bucket string + Region string + LocalDir string + ServerURL string + TemporaryExpire time.Duration + } +} diff --git a/internal/config/config.yaml b/internal/conf/conf.yaml similarity index 61% rename from internal/config/config.yaml rename to internal/conf/conf.yaml index dd034cb..c22bac2 100644 --- a/internal/config/config.yaml +++ b/internal/conf/conf.yaml @@ -1,17 +1,15 @@ -env: TEST +env: PROD server: http: - host: 127.0.0.1 - port: 7003 - timeout: 10s + addr: 127.0.0.1:7003 + timeout: 60s marshal: emitUnpopulated: true useProtoNames: true grpc: - host: 127.0.0.1 - port: 8003 - timeout: 10s + addr: 127.0.0.1:8003 + timeout: 60s log: level: 0 output: @@ -38,23 +36,32 @@ database: config: transformError: enable: true - initializer: - enable: true - path: deploy/data.sql maxLifetime: 2h #最大生存时间 maxOpenConn: 20 #最大连接数量 maxIdleConn: 10 #最大空闲数量 - logLevel: 4 #日志等级 + logLevel: 3 #日志等级 slowThreshold: 2s #慢sql阈值 +redis: + cache: + enable: true + host: 127.0.0.1:6379 + username: '' + password: '' business: + chunkSize: 1 + defaultMaxSize: 10 + defaultAcceptTypes: ["jpg","png","txt","ppt","pptx","mp4","pdf"] storage: type: local - serverPath: /resource/v1/static + endpoint: xxx + id: xxx + secret: xxx + bucket: resource-1323879016 + region: ap-nanjing +# serverUrl: http://cos.qlime.cn + serverUrl: http://127.0.0.1:7003/resource/api/v1/static localDir: static - maxSingularSize: 400 - maxChunkSize: 200 - maxChunkCount: 200 - acceptTypes: ["jpg","png","txt","ppt","pptx","mp4"] + temporaryExpire: 600s export: + ServerPath: '' localDir: static/export - expire: 3d \ No newline at end of file diff --git a/internal/config/config.go b/internal/config/config.go deleted file mode 100644 index 00fc867..0000000 --- a/internal/config/config.go +++ /dev/null @@ -1,24 +0,0 @@ -package config - -import "time" - -type Config struct { - Export struct { - LocalDir string - Expire time.Duration - } - Storage struct { - Type string - Endpoint string - Key string - Secret string - Bucket string - Region string - ServerPath string - LocalDir string - MaxSingularSize int64 - MaxChunkSize int64 - MaxChunkCount int64 - AcceptTypes []string - } -} diff --git a/internal/consts/consts.go b/internal/consts/consts.go deleted file mode 100644 index 2af9554..0000000 --- a/internal/consts/consts.go +++ /dev/null @@ -1,13 +0,0 @@ -package consts - -const ( - STATUS_PROGRESS = "PROGRESS" - STATUS_COMPLETED = "COMPLETED" - STATUS_FAILED = "FAILED" -) - -const ( - STORE_ALIYUN = "aliyun" - STORE_TENCENT = "tencent" - STORE_LOCAL = "local" -) diff --git a/internal/data/directory.go b/internal/data/directory.go new file mode 100755 index 0000000..2fcffe0 --- /dev/null +++ b/internal/data/directory.go @@ -0,0 +1,174 @@ +package data + +import ( + "errors" + "fmt" + + "github.com/limes-cloud/kratosx" + "github.com/limes-cloud/kratosx/pkg/valx" + "google.golang.org/protobuf/proto" + + biz "github.com/limes-cloud/resource/internal/biz/directory" + "github.com/limes-cloud/resource/internal/data/model" +) + +type directoryRepo struct { +} + +func NewDirectoryRepo() biz.Repo { + return &directoryRepo{} +} + +// ToDirectoryEntity model转entity +func (r directoryRepo) ToDirectoryEntity(m *model.Directory) *biz.Directory { + e := &biz.Directory{} + _ = valx.Transform(m, e) + return e +} + +// ToDirectoryModel entity转model +func (r directoryRepo) ToDirectoryModel(e *biz.Directory) *model.Directory { + m := &model.Directory{} + _ = valx.Transform(e, m) + return m +} + +// GetDirectory 获取指定的数据 +func (r directoryRepo) GetDirectory(ctx kratosx.Context, id uint32) (*biz.Directory, error) { + var ( + m = model.Directory{} + fs = []string{"*"} + ) + db := ctx.DB().Select(fs) + if err := db.First(&m, id).Error; err != nil { + return nil, err + } + + return r.ToDirectoryEntity(&m), nil +} + +// ListDirectory 获取列表 +func (r directoryRepo) ListDirectory(ctx kratosx.Context, req *biz.ListDirectoryRequest) ([]*biz.Directory, uint32, error) { + var ( + bs []*biz.Directory + ms []*model.Directory + total int64 + fs = []string{"*"} + ) + + db := ctx.DB().Model(model.Directory{}).Select(fs) + + if err := db.Count(&total).Error; err != nil { + return nil, 0, err + } + + if req.OrderBy == nil || *req.OrderBy == "" { + req.OrderBy = proto.String("id") + } + if req.Order == nil || *req.Order == "" { + req.Order = proto.String("asc") + } + db = db.Order(fmt.Sprintf("%s %s", *req.OrderBy, *req.Order)) + if *req.OrderBy != "id" { + db = db.Order("id asc") + } + + if err := db.Find(&ms).Error; err != nil { + return nil, 0, err + } + + for _, m := range ms { + bs = append(bs, r.ToDirectoryEntity(m)) + } + return bs, uint32(total), nil +} + +// CreateDirectory 创建数据 +func (r directoryRepo) CreateDirectory(ctx kratosx.Context, req *biz.Directory) (uint32, error) { + m := r.ToDirectoryModel(req) + return m.Id, ctx.Transaction(func(ctx kratosx.Context) error { + if err := ctx.DB().Create(m).Error; err != nil { + return err + } + return r.appendDirectoryChildren(ctx, req.ParentId, m.Id) + }) +} + +// UpdateDirectory 更新数据 +func (r directoryRepo) UpdateDirectory(ctx kratosx.Context, req *biz.Directory) error { + if req.Id == req.ParentId { + return errors.New("父级不能为自己") + } + old, err := r.GetDirectory(ctx, req.Id) + if err != nil { + return err + } + + return ctx.Transaction(func(ctx kratosx.Context) error { + if old.ParentId != req.ParentId { + if err := r.removeDirectoryParent(ctx, req.Id); err != nil { + return err + } + if err := r.appendDirectoryChildren(ctx, req.ParentId, req.Id); err != nil { + return err + } + } + return ctx.DB().Updates(r.ToDirectoryModel(req)).Error + }) +} + +// DeleteDirectory 删除数据 +func (r directoryRepo) DeleteDirectory(ctx kratosx.Context, ids []uint32) (uint32, error) { + var del []uint32 + for _, id := range ids { + del = append(del, id) + childrenIds, err := r.GetDirectoryChildrenIds(ctx, id) + if err != nil { + return 0, err + } + del = append(del, childrenIds...) + } + db := ctx.DB().Where("id in ?", del).Delete(&model.Directory{}) + return uint32(db.RowsAffected), db.Error +} + +// GetDirectoryChildrenIds 获取指定id的所有子id +func (r directoryRepo) GetDirectoryChildrenIds(ctx kratosx.Context, id uint32) ([]uint32, error) { + var ids []uint32 + return ids, ctx.DB().Model(model.DirectoryClosure{}). + Select("children"). + Where("parent=?", id). + Scan(&ids).Error +} + +// GetDirectoryParentIds 获取指定id的所有父id +func (r directoryRepo) GetDirectoryParentIds(ctx kratosx.Context, id uint32) ([]uint32, error) { + var ids []uint32 + return ids, ctx.DB().Model(model.DirectoryClosure{}). + Select("parent"). + Where("children=?", id). + Scan(&ids).Error +} + +// appendDirectoryChildren 添加id到指定的父id下 +func (r directoryRepo) appendDirectoryChildren(ctx kratosx.Context, pid uint32, id uint32) error { + list := []*model.DirectoryClosure{ + { + Parent: pid, + Children: id, + }, + } + ids, _ := r.GetDirectoryParentIds(ctx, pid) + for _, item := range ids { + list = append(list, &model.DirectoryClosure{ + Parent: item, + Children: id, + }) + } + return ctx.DB().Create(&list).Error +} + +// removeDirectoryParent 删除指定id的所有父层级 +func (r directoryRepo) removeDirectoryParent(ctx kratosx.Context, id uint32) error { + return ctx.DB().Delete(&model.DirectoryClosure{}, "children=?", id).Error +} diff --git a/internal/data/export.go b/internal/data/export.go new file mode 100755 index 0000000..0d2d6fe --- /dev/null +++ b/internal/data/export.go @@ -0,0 +1,89 @@ +package data + +import ( + "fmt" + + "github.com/limes-cloud/kratosx" + "github.com/limes-cloud/kratosx/pkg/valx" + "google.golang.org/protobuf/proto" + + biz "github.com/limes-cloud/resource/internal/biz/export" + "github.com/limes-cloud/resource/internal/data/model" +) + +type exportRepo struct { +} + +func NewExportRepo() biz.Repo { + return &exportRepo{} +} + +// ToExportEntity model转entity +func (r exportRepo) ToExportEntity(m *model.Export) *biz.Export { + e := &biz.Export{} + _ = valx.Transform(m, e) + return e +} + +// ToExportModel entity转model +func (r exportRepo) ToExportModel(e *biz.Export) *model.Export { + m := &model.Export{} + _ = valx.Transform(e, m) + return m +} + +// ListExport 获取列表 +func (r exportRepo) ListExport(ctx kratosx.Context, req *biz.ListExportRequest) ([]*biz.Export, uint32, error) { + var ( + bs []*biz.Export + ms []*model.Export + total int64 + fs = []string{"*"} + ) + + db := ctx.DB().Model(model.Export{}).Select(fs) + + if req.UserId != nil { + db = db.Where("user_id = ?", *req.UserId) + } + if req.DepartmentId != nil { + db = db.Where("department_id = ?", *req.DepartmentId) + } + + if err := db.Count(&total).Error; err != nil { + return nil, 0, err + } + db = db.Offset(int((req.Page - 1) * req.PageSize)).Limit(int(req.PageSize)) + + if req.OrderBy == nil || *req.OrderBy == "" { + req.OrderBy = proto.String("id") + } + if req.Order == nil || *req.Order == "" { + req.Order = proto.String("asc") + } + db = db.Order(fmt.Sprintf("%s %s", *req.OrderBy, *req.Order)) + if *req.OrderBy != "id" { + db = db.Order("id asc") + } + + if err := db.Find(&ms).Error; err != nil { + return nil, 0, err + } + + for _, m := range ms { + bs = append(bs, r.ToExportEntity(m)) + } + return bs, uint32(total), nil +} + +// CreateExport 创建数据 +func (r exportRepo) CreateExport(ctx kratosx.Context, req *biz.Export) (uint32, error) { + m := r.ToExportModel(req) + return m.Id, ctx.DB().Create(m).Error +} + +// DeleteExport 删除数据 +func (r exportRepo) DeleteExport(ctx kratosx.Context, ids []uint32) (uint32, error) { + db := ctx.DB().Where("id in ?", ids).Delete(&model.Export{}) + return uint32(db.RowsAffected), db.Error +} diff --git a/internal/data/export/repo.go b/internal/data/export/repo.go deleted file mode 100644 index 42adcbf..0000000 --- a/internal/data/export/repo.go +++ /dev/null @@ -1,54 +0,0 @@ -package export - -import ( - "github.com/limes-cloud/kratosx" - - "github.com/limes-cloud/resource/internal/biz/export" -) - -type repo struct { -} - -func NewRepo() export.Repo { - return &repo{} -} - -func (r repo) GetExport(ctx kratosx.Context, id uint32) (*export.Export, error) { - dir := export.Export{} - return &dir, ctx.DB().First(&dir, "id=?", id).Error -} - -func (r repo) GetExportByVersion(ctx kratosx.Context, uid uint32, version string) (*export.Export, error) { - dir := export.Export{} - return &dir, ctx.DB().First(&dir, "version=? and user_id=?", version, uid).Error -} - -func (r repo) PageExport(ctx kratosx.Context, in *export.PageExportRequest) ([]*export.Export, uint32, error) { - var list []*export.Export - total := int64(0) - - db := ctx.DB().Model(export.Export{}) - if err := db.Count(&total).Error; err != nil { - return nil, uint32(total), err - } - - db = db.Offset(int((in.Page - 1) * in.PageSize)).Limit(int(in.PageSize)) - - return list, uint32(total), db.Find(&list).Error -} - -func (r repo) AddExport(ctx kratosx.Context, export *export.Export) (uint32, error) { - return export.ID, ctx.DB().Create(export).Error -} - -func (r repo) UpdateExport(ctx kratosx.Context, export *export.Export) error { - return ctx.DB().Where("id=?", export.ID).Updates(export).Error -} - -func (r repo) UpdateExportExpire(ctx kratosx.Context, t int64) error { - return ctx.DB().Where("created_at <= ?", t).Update("status", export.StatusExpire).Error -} - -func (r repo) DeleteExport(ctx kratosx.Context, uid uint32, id uint32) error { - return ctx.DB().Where("id=? and user_id=?", id, uid).Delete(export.Export{}).Error -} diff --git a/internal/data/file.go b/internal/data/file.go new file mode 100755 index 0000000..69b4166 --- /dev/null +++ b/internal/data/file.go @@ -0,0 +1,284 @@ +package data + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/google/uuid" + "github.com/limes-cloud/kratosx" + "github.com/limes-cloud/kratosx/pkg/valx" + "google.golang.org/protobuf/proto" + "gorm.io/gorm" + "gorm.io/gorm/logger" + + biz "github.com/limes-cloud/resource/internal/biz/file" + "github.com/limes-cloud/resource/internal/conf" + "github.com/limes-cloud/resource/internal/data/model" + "github.com/limes-cloud/resource/internal/pkg/store" + "github.com/limes-cloud/resource/internal/pkg/store/aliyun" + "github.com/limes-cloud/resource/internal/pkg/store/local" + "github.com/limes-cloud/resource/internal/pkg/store/tencent" +) + +type fileRepo struct { + conf *conf.Config + store store.Store +} + +func NewFileRepo(conf *conf.Config) biz.Repo { + ctx := kratosx.MustContext(context.Background()) + cfg := &store.Config{ + Endpoint: conf.Storage.Endpoint, + Id: conf.Storage.Id, + Secret: conf.Storage.Secret, + Bucket: conf.Storage.Bucket, + LocalDir: conf.Storage.LocalDir, + DB: ctx.DB().Session(&gorm.Session{ + Logger: logger.Default.LogMode(logger.Silent), + }), + Cache: ctx.Redis(), + TemporaryExpire: conf.Storage.TemporaryExpire, + ServerURL: conf.Storage.ServerURL, + } + var ( + err error + st store.Store + ) + switch conf.Storage.Type { + case store.STORE_ALIYUN: + st, err = aliyun.New(cfg) + case store.STORE_TENCENT: + st, err = tencent.New(cfg) + case store.STORE_LOCAL: + st, err = local.New(cfg) + default: + err = errors.New("not support storage:" + conf.Storage.Type) + } + if err != nil { + panic(err) + } + return &fileRepo{ + conf: conf, + store: st, + } +} + +// ToFileEntity model转entity +func (r fileRepo) ToFileEntity(ctx kratosx.Context, m *model.File) *biz.File { + e := &biz.File{ + Id: m.Id, + DirectoryId: m.DirectoryId, + Name: m.Name, + Type: m.Type, + Size: m.Size, + Sha: m.Sha, + Src: m.Src, + Status: m.Status, + UploadId: m.UploadId, + ChunkCount: m.ChunkCount, + CreatedAt: m.CreatedAt, + UpdatedAt: m.UpdatedAt, + } + accessURL, err := r.store.GenTemporaryURL(m.Src) + if err != nil { + ctx.Logger().Warnf("gen template url error:%s", err.Error()) + } else { + e.URL = accessURL + } + return e +} + +// ToFileModel entity转model +func (r fileRepo) ToFileModel(e *biz.File) *model.File { + m := &model.File{} + _ = valx.Transform(e, m) + return m +} + +// GetFileBySha 获取指定数据 +func (r fileRepo) GetFileBySha(ctx kratosx.Context, sha string) (*biz.File, error) { + var ( + m = model.File{} + fs = []string{"*"} + ) + db := ctx.DB().Select(fs) + if err := db.Where("sha = ?", sha).First(&m).Error; err != nil { + return nil, err + } + + return r.ToFileEntity(ctx, &m), nil +} + +// GetFile 获取指定的数据 +func (r fileRepo) GetFile(ctx kratosx.Context, id uint32) (*biz.File, error) { + var ( + m = model.File{} + fs = []string{"*"} + ) + db := ctx.DB().Select(fs) + if err := db.First(&m, id).Error; err != nil { + return nil, err + } + + return r.ToFileEntity(ctx, &m), nil +} + +// ListFile 获取列表 +func (r fileRepo) ListFile(ctx kratosx.Context, req *biz.ListFileRequest) ([]*biz.File, uint32, error) { + var ( + bs []*biz.File + ms []*model.File + total int64 + fs = []string{"*"} + ) + + db := ctx.DB().Model(model.File{}).Select(fs) + + if req.DirectoryId != nil { + db = db.Where("directory_id = ?", *req.DirectoryId) + } + if req.Status != nil { + db = db.Where("status = ?", *req.Status) + } + + if err := db.Count(&total).Error; err != nil { + return nil, 0, err + } + db = db.Offset(int((req.Page - 1) * req.PageSize)).Limit(int(req.PageSize)) + + if req.OrderBy == nil || *req.OrderBy == "" { + req.OrderBy = proto.String("id") + } + if req.Order == nil || *req.Order == "" { + req.Order = proto.String("asc") + } + db = db.Order(fmt.Sprintf("%s %s", *req.OrderBy, *req.Order)) + if *req.OrderBy != "id" { + db = db.Order("id asc") + } + + if err := db.Find(&ms).Error; err != nil { + return nil, 0, err + } + + for _, m := range ms { + bs = append(bs, r.ToFileEntity(ctx, m)) + } + return bs, uint32(total), nil +} + +// CreateFile 创建数据 +func (r fileRepo) CreateFile(ctx kratosx.Context, req *biz.File) (uint32, error) { + m := r.ToFileModel(req) + return m.Id, ctx.DB().Create(m).Error +} + +// UpdateFile 更新数据 +func (r fileRepo) UpdateFile(ctx kratosx.Context, req *biz.File) error { + return ctx.DB().Updates(r.ToFileModel(req)).Error +} + +// DeleteFile 删除数据 +func (r fileRepo) DeleteFile(ctx kratosx.Context, ids []uint32) (uint32, error) { + var files []*model.File + if err := ctx.DB().Where("id in ?", ids).Find(&files).Error; err != nil { + return 0, err + } + + for _, item := range files { + if item.Status == biz.STATUS_COMPLETED { + _ = r.store.Delete(item.Src) + } else { + chunk, err := r.store.NewPutChunkByUploadID(item.Src, item.UploadId) + if err == nil { + _ = chunk.Abort() + } + } + } + + db := ctx.DB().Where("id in ?", ids).Delete(model.File{}) + return uint32(db.RowsAffected), db.Error +} + +func (r fileRepo) CopyFile(ctx kratosx.Context, src *biz.File, directoryId uint32, fileName string) error { + if src.DirectoryId == directoryId { + return nil + } + uids := strings.Split(uuid.NewString(), "-") + file := model.File{ + DirectoryId: directoryId, + Src: src.Src, + Name: fileName, + Status: src.Status, + UploadId: src.UploadId + "_copy_" + uids[0], + Type: src.Type, + Size: src.Size, + ChunkCount: src.ChunkCount, + Sha: src.Sha, + } + return ctx.DB().Create(&file).Error +} + +func (r fileRepo) UpdateFileStatus(ctx kratosx.Context, id uint32, status string) error { + return ctx.DB().Model(model.File{}).Where("id=?", id).Update("status", status).Error +} + +func (r fileRepo) GetFileByUploadId(ctx kratosx.Context, uid string) (*biz.File, error) { + var m model.File + if err := ctx.DB().Where("upload_id = ?", uid).First(&m).Error; err != nil { + return nil, err + } + + return r.ToFileEntity(ctx, &m), nil +} + +func (r fileRepo) GetDirectoryLimitByPath(ctx kratosx.Context, paths []string) (*biz.DirectoryLimit, error) { + var ( + dir = model.Directory{} + parent = uint32(0) + ) + + for _, path := range paths { + path = strings.TrimSpace(path) + if path == "" { + continue + } + nr := model.Directory{} + if err := ctx.DB().Where(model.Directory{ + ParentId: parent, + Name: path, + }).Attrs(model.Directory{ + Accept: strings.Join(r.conf.DefaultAcceptTypes, ","), + MaxSize: r.conf.DefaultMaxSize, + }).FirstOrCreate(&nr).Error; err != nil { + return nil, err + } + parent = nr.Id + dir = nr + } + + return &biz.DirectoryLimit{ + DirectoryId: dir.Id, + Accepts: strings.Split(dir.Accept, ","), + MaxSize: dir.MaxSize, + }, nil +} + +func (r fileRepo) GetDirectoryLimitById(ctx kratosx.Context, id uint32) (*biz.DirectoryLimit, error) { + var dir = model.Directory{} + if err := ctx.DB().Where("id=?", id).First(&dir).Error; err != nil { + return nil, err + } + + return &biz.DirectoryLimit{ + DirectoryId: dir.Id, + Accepts: strings.Split(dir.Accept, ","), + MaxSize: dir.MaxSize, + }, nil +} + +func (r fileRepo) GetStore() store.Store { + return r.store +} diff --git a/internal/data/file/repo.go b/internal/data/file/repo.go deleted file mode 100644 index 301dec8..0000000 --- a/internal/data/file/repo.go +++ /dev/null @@ -1,146 +0,0 @@ -package file - -import ( - "github.com/limes-cloud/kratosx" - - "github.com/limes-cloud/resource/internal/biz/file" - "github.com/limes-cloud/resource/internal/consts" -) - -type repo struct { -} - -func NewRepo() file.Repo { - return &repo{} -} - -func (r repo) AddDirectory(ctx kratosx.Context, in *file.Directory) (uint32, error) { - return in.ID, ctx.DB().Create(in).Error -} - -func (r repo) GetDirectoryByID(ctx kratosx.Context, id uint32) (*file.Directory, error) { - dir := file.Directory{} - return &dir, ctx.DB().First(&dir, "id=?", id).Error -} - -func (r repo) GetDirectoryByName(ctx kratosx.Context, id uint32, name string) (*file.Directory, error) { - dir := file.Directory{} - return &dir, ctx.DB().First(&dir, "parent_id=? and name=?", id, name).Error -} - -func (r repo) GetDirectoryByPaths(ctx kratosx.Context, app string, paths []string) (*file.Directory, error) { - dir := file.Directory{} - parent := uint32(0) - for _, path := range paths { - nr := file.Directory{} - if err := ctx.DB().Where(file.Directory{ - App: app, - ParentID: parent, - Name: path, - }).FirstOrCreate(&nr).Error; err != nil { - return nil, err - } - parent = nr.ID - dir = nr - } - return &dir, nil -} - -func (r repo) UpdateDirectory(ctx kratosx.Context, in *file.Directory) error { - return ctx.DB().Model(file.Directory{}).Updates(in).Error -} - -func (r repo) DeleteDirectory(ctx kratosx.Context, id uint32) error { - return ctx.DB().Where("id=?", id).Delete(file.Directory{}).Error -} - -func (r repo) AllDirectoryByParentID(ctx kratosx.Context, pid uint32, app string) ([]*file.Directory, error) { - var list []*file.Directory - return list, ctx.DB().Model(file.Directory{}).Find(&list, "parent_id=? and app=?", pid, app).Error -} - -func (r repo) DirectoryCountByParentID(ctx kratosx.Context, id uint32) (int64, error) { - var count int64 - return count, ctx.DB().Model(file.Directory{}).Where("parent_id=?", id).Count(&count).Error -} - -func (r repo) CopyFile(ctx kratosx.Context, src *file.File, did uint32, name string) error { - if src.DirectoryID == did { - return nil - } - - nf := *src - nf.ID = 0 - nf.DirectoryID = did - nf.Name = name - nf.CreatedAt = 0 - nf.UpdatedAt = 0 - nf.UploadID = nil - - return ctx.DB().Create(&nf).Error -} - -func (r repo) FileCountByName(ctx kratosx.Context, did uint32, name string) (int64, error) { - count := int64(0) - return count, ctx.DB().Model(file.File{}).Where("directory_id=? and name like ?", did, name+"%").Count(&count).Error -} - -func (r repo) FileCountByDirectoryID(ctx kratosx.Context, id uint32) (int64, error) { - count := int64(0) - return count, ctx.DB().Model(file.File{}).Where("directory_id=? ", id).Count(&count).Error -} - -func (r repo) GetFileByID(ctx kratosx.Context, id uint32) (*file.File, error) { - fe := file.File{} - return &fe, ctx.DB().First(&fe, "id=?", id).Error -} - -func (r repo) GetFileBySha(ctx kratosx.Context, sha string) (*file.File, error) { - fe := file.File{} - return &fe, ctx.DB().First(&fe, "sha=?", sha).Error -} - -func (r repo) GetFileByUploadID(ctx kratosx.Context, uid string) (*file.File, error) { - fe := file.File{} - return &fe, ctx.DB().First(&fe, "upload_id=?", uid).Error -} - -func (r repo) PageFile(ctx kratosx.Context, in *file.PageFileRequest) ([]*file.File, uint32, error) { - var list []*file.File - total := int64(0) - - db := ctx.DB().Model(file.File{}) - if in.Name != "" { - db = db.Where("name=?", in.Name) - } - if in.DirectoryId != 0 { - db = db.Where("directory_id=?", in.DirectoryId) - } - if err := db.Count(&total).Error; err != nil { - return nil, uint32(total), err - } - - db = db.Offset(int((in.Page - 1) * in.PageSize)).Limit(int(in.PageSize)) - - return list, uint32(total), db.Find(&list).Error -} - -func (r repo) AddFile(ctx kratosx.Context, file *file.File) error { - return ctx.DB().Create(file).Error -} - -func (r repo) UpdateFile(ctx kratosx.Context, file *file.File) error { - return ctx.DB().Where("id=?", file.ID).Updates(file).Error -} - -func (r repo) UpdateFileSuccess(ctx kratosx.Context, id uint32) error { - return ctx.DB().Model(file.File{}).Where("id=?", id).UpdateColumn("status", consts.STATUS_COMPLETED).Error -} - -func (r repo) DeleteFile(ctx kratosx.Context, id uint32) error { - return ctx.DB().Where("id=?", id).Delete(file.File{}).Error -} - -func (r repo) DeleteFiles(ctx kratosx.Context, did uint32, ids []uint32) error { - return ctx.DB().Where("directory_id=? and id in ?", did, ids).Delete(file.File{}).Error -} diff --git a/internal/data/model/directory.go b/internal/data/model/directory.go new file mode 100755 index 0000000..be74295 --- /dev/null +++ b/internal/data/model/directory.go @@ -0,0 +1,19 @@ +package model + +import ( + "github.com/limes-cloud/kratosx/types" +) + +type Directory struct { + ParentId uint32 `json:"parentId" gorm:"column:parent_id"` + Name string `json:"name" gorm:"column:name"` + Accept string `json:"accept" gorm:"column:accept"` + MaxSize uint32 `json:"maxSize" gorm:"column:max_size"` + types.BaseModel +} + +type DirectoryClosure struct { + ID uint32 `json:"id" gorm:"column:id"` + Parent uint32 `json:"parent" gorm:"column:parent"` + Children uint32 `json:"children" gorm:"column:children"` +} diff --git a/internal/data/model/export.go b/internal/data/model/export.go new file mode 100755 index 0000000..fc4038c --- /dev/null +++ b/internal/data/model/export.go @@ -0,0 +1,19 @@ +package model + +import ( + "github.com/limes-cloud/kratosx/types" +) + +type Export struct { + UserId uint32 `json:"userId" gorm:"column:user_id"` + DepartmentId uint32 `json:"departmentId" gorm:"column:department_id"` + Scene string `json:"scene" gorm:"column:scene"` + Name string `json:"name" gorm:"column:name"` + Size uint32 `json:"size" gorm:"column:size"` + Sha *string `json:"sha" gorm:"column:sha"` + Src *string `json:"src" gorm:"column:src"` + Status string `json:"status" gorm:"column:status"` + Reason *string `json:"reason" gorm:"column:reason"` + ExpiredAt int64 `json:"expiredAt" gorm:"column:expired_at"` + types.BaseModel +} diff --git a/internal/data/model/file.go b/internal/data/model/file.go new file mode 100755 index 0000000..2c49df4 --- /dev/null +++ b/internal/data/model/file.go @@ -0,0 +1,18 @@ +package model + +import ( + "github.com/limes-cloud/kratosx/types" +) + +type File struct { + DirectoryId uint32 `json:"directoryId" gorm:"column:directory_id"` + Name string `json:"name" gorm:"column:name"` + Type string `json:"type" gorm:"column:type"` + Size uint32 `json:"size" gorm:"column:size"` + Sha string `json:"sha" gorm:"column:sha"` + Src string `json:"src" gorm:"column:src"` + Status string `json:"status" gorm:"column:status"` + UploadId string `json:"uploadId" gorm:"column:upload_id"` + ChunkCount uint32 `json:"chunkCount" gorm:"column:chunk_count"` + types.BaseModel +} diff --git a/internal/factory/factory.go b/internal/factory/factory.go deleted file mode 100644 index d565933..0000000 --- a/internal/factory/factory.go +++ /dev/null @@ -1,362 +0,0 @@ -package factory - -import ( - "context" - "fmt" - "io" - "math" - "os" - "path/filepath" - "strings" - "sync" - "time" - - "github.com/gabriel-vasile/mimetype" - "github.com/limes-cloud/kratosx" - "github.com/limes-cloud/kratosx/pkg/util" - "github.com/limes-cloud/kratosx/pkg/xlsx" - - "github.com/limes-cloud/resource/api/errors" - "github.com/limes-cloud/resource/internal/biz/export" - "github.com/limes-cloud/resource/internal/biz/file" - "github.com/limes-cloud/resource/internal/config" - "github.com/limes-cloud/resource/internal/consts" - store2 "github.com/limes-cloud/resource/internal/pkg/store" - "github.com/limes-cloud/resource/internal/pkg/store/aliyun" - "github.com/limes-cloud/resource/internal/pkg/store/local" - "github.com/limes-cloud/resource/internal/pkg/store/tencent" -) - -type Factory struct { - conf *config.Config - fileRepo file.Repo - exportRepo export.Repo -} - -var ( - _ins *Factory - once sync.Once -) - -func New(conf *config.Config, fileRepo file.Repo, exportRepo export.Repo) *Factory { - once.Do(func() { - _ins = &Factory{conf: conf, fileRepo: fileRepo, exportRepo: exportRepo} - go func() { - _ins.ClearExportCache() - time.Sleep(1 * time.Hour) - }() - }) - return _ins -} - -func (f *Factory) Storage() string { - return f.conf.Storage.Type -} - -// ChunkCount 通过文件大小获取分片数量 -func (f *Factory) ChunkCount(size int64) int { - return int(math.Ceil(float64(size) / float64(f.MaxChunkSize()))) -} - -// GetType 获取文件类型 -func (f *Factory) GetType(name string) string { - index := strings.LastIndex(name, ".") - suffix := "" - if index != -1 { - suffix = name[index+1:] - } - return suffix -} - -// StoreKey 获取存储的key -func (f *Factory) StoreKey(sha, tp string) string { - return fmt.Sprintf("%s.%s", sha, tp) -} - -// CheckType 检查文件类型是否合法 -func (f *Factory) CheckType(tp string) error { - if !util.InList(f.conf.Storage.AcceptTypes, tp) { - return errors.UploadFileFormat("不支持的文件后缀") - } - return nil -} - -// CheckSize 检查大小是否合法 -func (f *Factory) CheckSize(size int64) error { - if size > f.MaxChunkSize()*f.conf.Storage.MaxChunkCount { - return errors.UploadFileFormat("超过传输文件大小") - } - return nil -} - -// MaxSingularSize 获取单个文件的最大大小,单位KB -func (f *Factory) MaxSingularSize() int64 { - return f.conf.Storage.MaxSingularSize * 1024 -} - -// MaxChunkSize 获取分片的大小 单位KB -func (f *Factory) MaxChunkSize() int64 { - return f.conf.Storage.MaxChunkSize * 1024 -} - -func (f *Factory) FileSrcFormat() string { - switch f.Storage() { - case consts.STORE_ALIYUN: - return "https://" + f.conf.Storage.Bucket + ".oss-cn-" + f.conf.Storage.Region + ".aliyuncs.com" + "/{src}" - case consts.STORE_TENCENT: - return "https://" + f.conf.Storage.Bucket + ".cos." + f.conf.Storage.Region + ".myqcloud.com" + "/{src}" - case consts.STORE_LOCAL: - return f.conf.Storage.ServerPath + "/{src}" - } - return "%s" -} - -func (f *Factory) ExportFileSrc(src string) string { - prefix := f.conf.Export.LocalDir - if index := strings.Index(f.conf.Export.LocalDir, "/"); index != -1 { - prefix = f.conf.Export.LocalDir[index:] - } - return f.conf.Storage.ServerPath + prefix + "/" + src -} - -func (f *Factory) FileSrc(src string) string { - return strings.Replace(f.FileSrcFormat(), "{src}", src, 1) -} - -// FileMime 获取文件的Mime -func (f *Factory) FileMime(body []byte) string { - return mimetype.Detect(body).String() -} - -func (f *Factory) Store(ctx kratosx.Context) (store2.Store, error) { - c := &store2.Config{ - Endpoint: f.conf.Storage.Endpoint, - Key: f.conf.Storage.Key, - Secret: f.conf.Storage.Secret, - Bucket: f.conf.Storage.Bucket, - LocalDir: f.conf.Storage.LocalDir, - DB: ctx.DB(), - } - switch f.Storage() { - case consts.STORE_ALIYUN: - return aliyun.New(c) - case consts.STORE_TENCENT: - return tencent.New(c) - case consts.STORE_LOCAL: - return local.New(c) - default: - return nil, errors.NoSupportStore() - } -} - -// ExportFile 导出指定的文件列表 -func (f *Factory) ExportFile(ctx kratosx.Context, in *export.AddExportRequest) (int64, error) { - if util.IsExistFile(in.Name) { - _ = os.Chtimes(in.Name, time.Now(), time.Now()) - stat, err := os.Stat(in.Name) - if err != nil { - return 0, err - } - return stat.Size(), nil - } - - dir := f.conf.Export.LocalDir - if !util.IsExistFolder(dir) { - if err := os.MkdirAll(dir, os.ModePerm); err != nil { - return 0, err - } - } - - var exports = make(map[string]string) - - if len(in.Ids) != 0 { - for _, id := range in.Ids { - fe, err := f.fileRepo.GetFileByID(ctx, id) - if err != nil { - ctx.Logger().Errorw("msg", "get file error", "err", err.Error()) - continue - } - exports[fe.Src] = fe.Src - } - } else { - for _, item := range in.Files { - if item.Sha == "" { - continue - } - fe, err := f.fileRepo.GetFileBySha(ctx, item.Sha) - if err != nil { - ctx.Logger().Errorw("msg", "get file error", "err", err.Error()) - continue - } - exports[fe.Src] = fe.Src - if item.Rename != "" { - exports[fe.Src] = item.Rename + filepath.Ext(fe.Src) - } - } - } - - store, err := f.Store(ctx) - if err != nil { - return 0, err - } - if f.Storage() != consts.STORE_LOCAL { - var remoteExports = make(map[string]string) - for src, rename := range exports { - path := dir + "/" + rename - if util.IsExistFile(path) { - continue - } - - fd, err := os.Create(path) - if err != nil { - ctx.Logger().Errorw("msg", "create file err", "path", path, "err", err.Error()) - continue - } - - reader, err := store.Get(src) - if err != nil { - ctx.Logger().Errorw("msg", "get remote file error", "path", path, "err", err.Error()) - continue - } - - if _, err := io.Copy(fd, reader); err != nil { - ctx.Logger().Errorw("msg", "save remote file error", "path", path, "download err", err.Error()) - continue - } - - remoteExports[path] = rename + filepath.Ext(path) - } - exports = remoteExports - } else { - var localExports = make(map[string]string) - for src, rename := range exports { - path := strings.ReplaceAll(f.conf.Storage.LocalDir+"/"+src, "//", "/") - localExports[path] = rename - } - exports = localExports - } - if err := util.ZipFiles(in.Name, exports); err != nil { - return 0, err - } - - stat, err := os.Stat(in.Name) - if err != nil { - return 0, err - } - return stat.Size(), nil -} - -// ExportExcel 导出指定的数据列表为excel -func (f *Factory) ExportExcel(ctx kratosx.Context, in *export.AddExportExcelRequest) (int64, error) { - if util.IsExistFile(in.Name) { - _ = os.Chtimes(in.Name, time.Now(), time.Now()) - stat, err := os.Stat(in.Name) - if err != nil { - return 0, err - } - return stat.Size(), nil - } - dir := f.conf.Export.LocalDir - if !util.IsExistFolder(dir) { - if err := os.MkdirAll(dir, os.ModePerm); err != nil { - return 0, err - } - } - - store, err := f.Store(ctx) - if err != nil { - return 0, err - } - - xlsxFile := xlsx.New(in.Name).Writer() - for _, list := range in.Rows { - var temp []any - for _, item := range list { - switch item.Type { - case "image": - if item.Value == "" { - continue - } - fe, err := f.fileRepo.GetFileBySha(ctx.Clone(), item.Value) - if err != nil { - ctx.Logger().Errorw("msg", "get file error", "err", err.Error()) - continue - } - if f.Storage() != consts.STORE_LOCAL { - path := dir + "/" + fe.Src - if util.IsExistFile(path) { - if fd, err := os.Open(path); err == nil { - temp = append(temp, fd) - continue - } - } - - fd, err := os.Create(path) - if err != nil { - ctx.Logger().Errorw("path", path, "create file err", err.Error()) - continue - } - - reader, err := store.Get(fe.Src) - if err != nil { - ctx.Logger().Errorw("path", path, "get err", err.Error()) - continue - } - - if _, err := io.Copy(fd, reader); err != nil { - ctx.Logger().Errorw("path", path, "download err", err.Error()) - continue - } - temp = append(temp, fd) - } else { - path := strings.ReplaceAll(f.conf.Storage.LocalDir+"/"+fe.Src, "//", "/") - fd, err := os.Open(path) - if err != nil { - ctx.Logger().Errorw("path", path, "download err", err.Error()) - continue - } - temp = append(temp, fd) - } - - default: - temp = append(temp, item.Value) - } - } - if err := xlsxFile.WriteRow(temp); err != nil { - ctx.Logger().Errorw("msg", "write xlsx row error", "err", err.Error()) - } - } - - if err := xlsxFile.Save(); err != nil { - return 0, err - } - stat, err := os.Stat(in.Name) - if err != nil { - return 0, err - } - return stat.Size(), nil -} - -func (f *Factory) ClearExportCache() { - dir := f.conf.Export.LocalDir - if !util.IsExistFolder(dir) { - return - } - _ = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if path == dir { - return nil - } - if err != nil { - return err - } - d := time.Since(info.ModTime()) - if d.Seconds() >= f.conf.Export.Expire.Seconds() { - _ = os.RemoveAll(path) - } - return err - }) - _ = f.exportRepo.UpdateExportExpire( - kratosx.MustContext(context.Background()), - time.Now().Unix()-int64(f.conf.Export.Expire.Seconds()), - ) -} diff --git a/internal/pkg/image/image.go b/internal/pkg/image/image.go index 36be19c..ee8adbb 100644 --- a/internal/pkg/image/image.go +++ b/internal/pkg/image/image.go @@ -9,9 +9,8 @@ import ( "image/png" "strings" - "golang.org/x/image/bmp" - "github.com/nfnt/resize" + "golang.org/x/image/bmp" ) const ( diff --git a/internal/pkg/store/aliyun/store.go b/internal/pkg/store/aliyun/store.go index 26d1158..9088096 100644 --- a/internal/pkg/store/aliyun/store.go +++ b/internal/pkg/store/aliyun/store.go @@ -2,17 +2,26 @@ package aliyun import ( "bytes" + "context" + "crypto/md5" "errors" + "fmt" "io" "strconv" + "time" "github.com/aliyun/aliyun-oss-go-sdk/oss" + "github.com/go-redis/redis/v8" + "github.com/limes-cloud/kratosx/pkg/lock" - store2 "github.com/limes-cloud/resource/internal/pkg/store" + "github.com/limes-cloud/resource/internal/pkg/store" ) type aliyun struct { bucket *oss.Bucket + expire time.Duration + cache *redis.Client + cdn string } type upload struct { @@ -20,12 +29,12 @@ type upload struct { upload oss.InitiateMultipartUploadResult } -func New(conf *store2.Config) (store2.Store, error) { - if conf.Endpoint == "" || conf.Key == "" || conf.Secret == "" { +func New(conf *store.Config) (store.Store, error) { + if conf.Endpoint == "" || conf.Id == "" || conf.Secret == "" { return nil, errors.New("store config error") } - client, err := oss.New(conf.Endpoint, conf.Key, conf.Secret) + client, err := oss.New(conf.Endpoint, conf.Id, conf.Secret) if err != nil { return nil, err } @@ -37,9 +46,46 @@ func New(conf *store2.Config) (store2.Store, error) { return &aliyun{ bucket: bucket, + expire: conf.TemporaryExpire, + cache: conf.Cache, + cdn: conf.ServerURL, }, nil } +func (s *aliyun) GenTemporaryURL(key string) (string, error) { + var ( + err error + target string + locker = lock.New(s.cache, key+":lock") + ) + ck := fmt.Sprintf("resource:%x", md5.Sum([]byte(key))) + err = locker.AcquireFunc(context.Background(), + func() error { + target, err = s.cache.Get(context.Background(), ck).Result() + return err + }, + func() error { + t := time.Now().Add(s.expire).Format("200601021504") + st := s.bucket.Client.Config.AccessKeySecret + t + "/" + key + target = fmt.Sprintf("%s/%s/%s/%s", + s.cdn, + t, + fmt.Sprintf("%x", md5.Sum([]byte(st))), + key, + ) + return s.cache.Set(context.Background(), ck, target, s.expire-10*time.Second).Err() + }, + ) + if err != nil { + return "", err + } + return target, nil +} + +func (s *aliyun) VerifyTemporaryURL(key string, expire string, sign string) error { + return nil +} + func (s *aliyun) PutBytes(key string, in []byte) error { return s.bucket.PutObject(key, bytes.NewReader(in)) } @@ -74,7 +120,7 @@ func (s *aliyun) Exists(key string) (bool, error) { return s.bucket.IsObjectExist(key) } -func (s *aliyun) NewPutChunk(key string) (store2.PutChunk, error) { +func (s *aliyun) NewPutChunk(key string) (store.PutChunk, error) { up, err := s.bucket.InitiateMultipartUpload(key) if err != nil { return nil, err @@ -85,7 +131,7 @@ func (s *aliyun) NewPutChunk(key string) (store2.PutChunk, error) { }, nil } -func (s *aliyun) NewPutChunkByUploadID(key, id string) (store2.PutChunk, error) { +func (s *aliyun) NewPutChunkByUploadID(key, id string) (store.PutChunk, error) { up := oss.InitiateMultipartUploadResult{ XMLName: struct{ Space, Local string }{Space: "", Local: "InitiateMultipartUploadResult"}, UploadID: id, @@ -98,11 +144,11 @@ func (s *aliyun) NewPutChunkByUploadID(key, id string) (store2.PutChunk, error) }, nil } -func (u *upload) UploadedChunkIndex() []int { - var arr []int +func (u *upload) UploadedChunkIndex() []uint32 { + var arr []uint32 lsRes, _ := u.bucket.ListUploadedParts(u.upload) for _, item := range lsRes.UploadedParts { - arr = append(arr, item.PartNumber) + arr = append(arr, uint32(item.PartNumber)) } return arr } diff --git a/internal/pkg/store/config.go b/internal/pkg/store/config.go index 027f20d..28de19f 100644 --- a/internal/pkg/store/config.go +++ b/internal/pkg/store/config.go @@ -1,12 +1,20 @@ package store -import "gorm.io/gorm" +import ( + "time" + + "github.com/go-redis/redis/v8" + "gorm.io/gorm" +) type Config struct { - Endpoint string - Key string - Secret string - Bucket string - LocalDir string - DB *gorm.DB + Endpoint string + Id string + Secret string + Bucket string + DB *gorm.DB + Cache *redis.Client + LocalDir string + ServerURL string + TemporaryExpire time.Duration } diff --git a/internal/pkg/store/local/store.go b/internal/pkg/store/local/store.go index bf8f908..193e9a3 100644 --- a/internal/pkg/store/local/store.go +++ b/internal/pkg/store/local/store.go @@ -2,22 +2,32 @@ package local import ( "bytes" + "context" + "crypto/md5" "errors" + "fmt" "io" "os" "strings" + "time" "unsafe" + "github.com/go-redis/redis/v8" "github.com/google/uuid" - "github.com/limes-cloud/kratosx/pkg/util" + "github.com/limes-cloud/kratosx/pkg/crypto" + "github.com/limes-cloud/kratosx/pkg/lock" "gorm.io/gorm" - store2 "github.com/limes-cloud/resource/internal/pkg/store" + "github.com/limes-cloud/resource/internal/pkg/store" ) type local struct { - dir string - db *gorm.DB + dir string + db *gorm.DB + secret string + cache *redis.Client + expire time.Duration + url string } type upload struct { @@ -26,16 +36,68 @@ type upload struct { local *local } -func New(conf *store2.Config) (store2.Store, error) { - if conf.LocalDir == "" { - return nil, errors.New("upload config error") - } +func New(conf *store.Config) (store.Store, error) { return &local{ - dir: conf.LocalDir, - db: conf.DB, + dir: conf.LocalDir, + db: conf.DB, + secret: conf.Secret, + expire: conf.TemporaryExpire, + cache: conf.Cache, + url: conf.ServerURL, }, nil } +func (s *local) GenTemporaryURL(key string) (string, error) { + var ( + err error + target string + locker = lock.New(s.cache, key+":lock") + ) + ck := fmt.Sprintf("resource:%x", md5.Sum([]byte(key))) + err = locker.AcquireFunc(context.Background(), + func() error { + target, err = s.cache.Get(context.Background(), ck).Result() + return err + }, + func() error { + t := time.Now().Add(s.expire).Format("200601021504") + st := s.secret + t + "/" + key + target = fmt.Sprintf("%s/%s/%s/%s", + s.url, + t, + fmt.Sprintf("%x", md5.Sum([]byte(st))), + key, + ) + return s.cache.Set(context.Background(), ck, target, s.expire-10*time.Second).Err() + }, + ) + if err != nil { + return "", err + } + return target, nil +} + +func (s *local) VerifyTemporaryURL(key string, expire string, sign string) error { + t, err := time.Parse("200601021504", expire) + if err != nil { + return err + } + + // 校验时间 + if time.Now().Unix() > t.Unix() { + return errors.New("url is expire") + } + + // 重新计算签名 + st := s.secret + expire + "/" + key + oriSign := fmt.Sprintf("%x", md5.Sum([]byte(st))) + if oriSign != sign { + return errors.New("sign is invoke") + } + + return nil +} + func (s *local) PutBytes(key string, in []byte) error { return s.Put(key, bytes.NewReader(in)) } @@ -105,7 +167,7 @@ func (s *local) makeDir(path string) error { return nil } -func (s *local) NewPutChunk(key string) (store2.PutChunk, error) { +func (s *local) NewPutChunk(key string) (store.PutChunk, error) { return &upload{ uuid: uuid.NewString(), local: s, @@ -113,7 +175,7 @@ func (s *local) NewPutChunk(key string) (store2.PutChunk, error) { }, nil } -func (s *local) NewPutChunkByUploadID(key, id string) (store2.PutChunk, error) { +func (s *local) NewPutChunkByUploadID(key, id string) (store.PutChunk, error) { return &upload{ uuid: id, local: s, @@ -127,12 +189,12 @@ func (u *upload) ChunkCount() int { return len(chunks) } -func (u *upload) UploadedChunkIndex() []int { - var arr []int +func (u *upload) UploadedChunkIndex() []uint32 { + var arr []uint32 chunk := Chunk{} chunks, _ := chunk.Parts(u.local.db, u.uuid) for _, item := range chunks { - arr = append(arr, item.Index) + arr = append(arr, uint32(item.Index)) } return arr } @@ -147,7 +209,7 @@ func (u *upload) Append(r io.Reader, index int) error { return err } - sha := util.Sha256(all) + sha := crypto.Sha256(all) oldChunk := Chunk{} // 查询是否已经存在数据 @@ -158,7 +220,7 @@ func (u *upload) Append(r io.Reader, index int) error { chunk := Chunk{ UploadID: u.uuid, Index: index, - Sha: util.Sha256(all), + Sha: crypto.Sha256(all), Size: len(all), Data: *(*string)(unsafe.Pointer(&all)), } @@ -171,7 +233,7 @@ func (u *upload) AppendBytes(r []byte, index int) error { UploadID: u.uuid, Index: index, Size: len(r), - Sha: util.Sha256(r), + Sha: crypto.Sha256(r), Data: *(*string)(unsafe.Pointer(&r)), } diff --git a/internal/pkg/store/tencent/store.go b/internal/pkg/store/tencent/store.go index b7d7722..29ca915 100644 --- a/internal/pkg/store/tencent/store.go +++ b/internal/pkg/store/tencent/store.go @@ -3,18 +3,26 @@ package tencent import ( "bytes" "context" + "crypto/md5" "errors" + "fmt" "io" "net/http" "net/url" + "time" + "github.com/go-redis/redis/v8" + "github.com/limes-cloud/kratosx/pkg/lock" "github.com/tencentyun/cos-go-sdk-v5" - store2 "github.com/limes-cloud/resource/internal/pkg/store" + "github.com/limes-cloud/resource/internal/pkg/store" ) type tencent struct { client *cos.Client + expire time.Duration + cache *redis.Client + cdn string } type upload struct { @@ -22,8 +30,8 @@ type upload struct { upload *cos.InitiateMultipartUploadResult } -func New(conf *store2.Config) (store2.Store, error) { - if conf.Endpoint == "" || conf.Secret == "" || conf.Key == "" { +func New(conf *store.Config) (store.Store, error) { + if conf.Endpoint == "" || conf.Secret == "" || conf.Id == "" { return nil, errors.New("upload config error") } @@ -35,12 +43,46 @@ func New(conf *store2.Config) (store2.Store, error) { b := &cos.BaseURL{BucketURL: u} client := cos.NewClient(b, &http.Client{ Transport: &cos.AuthorizationTransport{ - SecretID: conf.Secret, - SecretKey: conf.Key, + SecretID: conf.Id, + SecretKey: conf.Secret, }, }) - return &tencent{client: client}, nil + return &tencent{client: client, expire: conf.TemporaryExpire, cache: conf.Cache, cdn: conf.ServerURL}, nil +} + +func (s *tencent) GenTemporaryURL(key string) (string, error) { + var ( + err error + target string + locker = lock.New(s.cache, key+":lock") + ) + ck := fmt.Sprintf("resource:%x", md5.Sum([]byte(key))) + err = locker.AcquireFunc(context.Background(), + func() error { + target, err = s.cache.Get(context.Background(), ck).Result() + return err + }, + func() error { + t := time.Now().Add(s.expire).Format("200601021504") + st := s.client.GetCredential().GetSecretKey() + t + "/" + key + target = fmt.Sprintf("%s/%s/%s/%s", + s.cdn, + t, + fmt.Sprintf("%x", md5.Sum([]byte(st))), + key, + ) + return s.cache.Set(context.Background(), ck, target, s.expire-10*time.Second).Err() + }, + ) + if err != nil { + return "", err + } + return target, nil +} + +func (s *tencent) VerifyTemporaryURL(key string, expire string, sign string) error { + return nil } func (s *tencent) PutBytes(key string, in []byte) error { @@ -113,7 +155,7 @@ func httpError(response *cos.Response) error { return errors.New(string(bt)) } -func (s *tencent) NewPutChunk(key string) (store2.PutChunk, error) { +func (s *tencent) NewPutChunk(key string) (store.PutChunk, error) { up, _, err := s.client.Object.InitiateMultipartUpload(context.Background(), key, nil) if err != nil { return nil, err @@ -124,7 +166,7 @@ func (s *tencent) NewPutChunk(key string) (store2.PutChunk, error) { }, nil } -func (s *tencent) NewPutChunkByUploadID(key, id string) (store2.PutChunk, error) { +func (s *tencent) NewPutChunkByUploadID(key, id string) (store.PutChunk, error) { bucket, _, err := s.client.Bucket.Get(context.Background(), nil) if err != nil { return nil, err @@ -142,11 +184,11 @@ func (s *tencent) NewPutChunkByUploadID(key, id string) (store2.PutChunk, error) }, nil } -func (u *upload) UploadedChunkIndex() []int { - var arr []int +func (u *upload) UploadedChunkIndex() []uint32 { + var arr []uint32 lsRes, _, _ := u.client.Object.ListParts(context.Background(), u.upload.Key, u.upload.UploadID, nil) for _, item := range lsRes.Parts { - arr = append(arr, item.PartNumber) + arr = append(arr, uint32(item.PartNumber)) } return arr } diff --git a/internal/pkg/store/types.go b/internal/pkg/store/types.go index 9721609..47eded9 100644 --- a/internal/pkg/store/types.go +++ b/internal/pkg/store/types.go @@ -2,40 +2,66 @@ package store import "io" +const ( + STORE_ALIYUN = "aliyun" + STORE_TENCENT = "tencent" + STORE_LOCAL = "local" +) + type Store interface { + // GenTemporaryURL 生成临时访问路径 + GenTemporaryURL(key string) (string, error) + + // VerifyTemporaryURL 验证临时url + VerifyTemporaryURL(key string, expire string, sign string) error + // PutBytes 上传文件 PutBytes(key string, in []byte) error + // Put 上传文件 Put(key string, r io.Reader) error + // PutFromLocal 从本地上传文件 PutFromLocal(key string, localPath string) error + // Get 查询文件 Get(key string) (io.ReadCloser, error) + // Delete 删除文件 Delete(key string) error + // Size 获取文件大小 Size(key string) (int64, error) + // Exists 判断文件大小 Exists(key string) (bool, error) + // NewPutChunk 创建上传切片对象 NewPutChunk(key string) (PutChunk, error) + // NewPutChunkByUploadID 通过upload_id创建切片对象 NewPutChunkByUploadID(key string, id string) (PutChunk, error) } type PutChunk interface { // UploadedChunkIndex 已经上传的切片下标 - UploadedChunkIndex() []int + UploadedChunkIndex() []uint32 + // ChunkCount 查询切片数量 ChunkCount() int + // UploadID 获取上传id UploadID() string + // AppendBytes 添加字节 AppendBytes(in []byte, index int) error + // Append 添加io Append(r io.Reader, index int) error + // Abort 取消上传 Abort() error + // Complete 完成合并 Complete() error } diff --git a/internal/pkg/util/util.go b/internal/pkg/util/util.go new file mode 100644 index 0000000..6ca6d11 --- /dev/null +++ b/internal/pkg/util/util.go @@ -0,0 +1,19 @@ +package util + +import ( + "strings" +) + +// GetFileType 获取文件类型 +func GetFileType(name string) string { + index := strings.LastIndex(name, ".") + suffix := "" + if index != -1 { + suffix = name[index+1:] + } + return suffix +} + +func GetKBSize(mSize uint32) uint32 { + return mSize * 1024 +} diff --git a/internal/router/router.go b/internal/router/router.go deleted file mode 100644 index e83bf0d..0000000 --- a/internal/router/router.go +++ /dev/null @@ -1,16 +0,0 @@ -package router - -import ( - "github.com/go-kratos/kratos/v2/transport/http" - - "github.com/limes-cloud/resource/internal/service" -) - -func Register(hs *http.Server, fileSrv *service.FileService) { - cr := hs.Route("/") - cr.GET("/resource/v1/static/export/{src}", SrcBlob(fileSrv)) - cr.GET("/resource/v1/static/{src}", SrcBlob(fileSrv)) - cr.POST("/resource/v1/upload", Upload(fileSrv)) - cr.POST("/resource/client/v1/upload", Upload(fileSrv)) - // cr.GET("/resource/v1/download", Download(fileSrv)) -} diff --git a/internal/router/upload.go b/internal/router/upload.go deleted file mode 100644 index 601b82a..0000000 --- a/internal/router/upload.go +++ /dev/null @@ -1,46 +0,0 @@ -package router - -import ( - "context" - "io" - - "github.com/go-kratos/kratos/v2/transport/http" - "github.com/limes-cloud/kratosx/pkg/util" - - "github.com/limes-cloud/resource/api/errors" - pb "github.com/limes-cloud/resource/api/file/v1" - "github.com/limes-cloud/resource/internal/service" -) - -func Upload(srv *service.FileService) http.HandlerFunc { - return func(ctx http.Context) error { - var in pb.UploadFileRequest - - in.UploadId = ctx.Request().FormValue("upload_id") - in.Index = util.ToUint32(ctx.Request().FormValue("index")) - file, _, err := ctx.Request().FormFile("data") - if err != nil { - return errors.UploadFileFormat(err.Error()) - } - - in.Data, err = io.ReadAll(file) - if err != nil { - return errors.UploadFileFormat(err.Error()) - } - - if in.UploadId == "" || int(in.Index) <= 0 || len(in.Data) == 0 { - return errors.UploadFileFormat("参数缺失") - } - - h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { - return srv.UploadFile(ctx, req.(*pb.UploadFileRequest)) - }) - - out, err := h(ctx, &in) - if err != nil { - return err - } - reply := out.(*pb.UploadFileReply) - return ctx.Result(200, reply) - } -} diff --git a/internal/router/blob.go b/internal/service/blob.go similarity index 51% rename from internal/router/blob.go rename to internal/service/blob.go index fe54849..43de204 100644 --- a/internal/router/blob.go +++ b/internal/service/blob.go @@ -1,4 +1,4 @@ -package router +package service import ( "bytes" @@ -10,10 +10,9 @@ import ( thttp "github.com/go-kratos/kratos/v2/transport/http" - "github.com/limes-cloud/resource/api/errors" - pb "github.com/limes-cloud/resource/api/file/v1" + "github.com/limes-cloud/resource/api/resource/errors" + pb "github.com/limes-cloud/resource/api/resource/file/v1" "github.com/limes-cloud/resource/internal/pkg/image" - "github.com/limes-cloud/resource/internal/service" ) type ResponseWriterWrapper struct { @@ -42,32 +41,45 @@ func (w *ResponseWriterWrapper) WriteString(s string) (int, error) { return w.body.WriteString(s) } -func SrcBlob(srv *service.FileService) thttp.HandlerFunc { +func (s *FileService) LocalPath(next http.Handler, src string) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + r.URL.Path = src + next.ServeHTTP(w, r) + }) +} + +func (s *FileService) SrcBlob() thttp.HandlerFunc { return func(ctx thttp.Context) error { - var in pb.GetFileRequest - if err := ctx.BindQuery(&in); err != nil { + var req pb.StaticFileRequest + if err := ctx.BindQuery(&req); err != nil { return err } - if err := ctx.BindVars(&in); err != nil { + if err := ctx.BindVars(&req); err != nil { + return err + } + + if err := s.uc.VerifyURL(req.Src, req.Expire, req.Sign); err != nil { return err } blw := NewWriter() - fs := http.FileServer(http.Dir(srv.Config().Storage.LocalDir)) - fs = http.StripPrefix(srv.Config().Storage.ServerPath, fs) + fs := http.FileServer(http.Dir(s.conf.Storage.LocalDir)) + fs = s.LocalPath(fs, req.Src) fs.ServeHTTP(blw, ctx.Request()) + // http.Redirect(w, r, "https://taadis.com", http.StatusMovedPermanently) + // 处理图片裁剪 cType := blw.header.Get("Content-Type") - if strings.Contains(cType, "image/") && in.Width > 0 && in.Height > 0 { + if strings.Contains(cType, "image/") && req.Width > 0 && req.Height > 0 { blw.header.Del("Content-Length") tp := strings.Split(cType, "/")[1] rb := blw.body.Bytes() if img, err := image.New(tp, rb); err == nil { - if in.Mode == "" { - in.Mode = image.AspectFill + if req.Mode == "" { + req.Mode = image.AspectFill } - if nrb, err := img.Resize(int(in.Width), int(in.Height), in.Mode); err == nil { + if nrb, err := img.Resize(int(req.Width), int(req.Height), req.Mode); err == nil { blw.body = bytes.NewBuffer(nrb) blw.header.Set("Content-Length", strconv.Itoa(len(nrb))) } @@ -80,10 +92,10 @@ func SrcBlob(srv *service.FileService) thttp.HandlerFunc { header.Set(key, blw.header.Get(key)) } - if in.Download { - fn := in.Src - if in.SaveName != "" { - fn = in.SaveName + filepath.Ext(in.Src) + if req.Download { + fn := req.Src + if req.SaveName != "" { + fn = req.SaveName + filepath.Ext(req.Src) } header.Set("Content-Type", "application/octet-stream") header.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", fn)) @@ -91,37 +103,9 @@ func SrcBlob(srv *service.FileService) thttp.HandlerFunc { ctx.Response().WriteHeader(blw.code) if _, err := ctx.Response().Write(blw.body.Bytes()); err != nil { - return errors.System() + return errors.SystemError() } return nil } } - -// func SrcBlob(srv *service.FileService) http.HandlerFunc { -// return func(ctx http.Context) error { -// var in pb.GetFileRequest -// if err := ctx.BindQuery(&in); err != nil { -// return err -// } -// if err := ctx.BindVars(&in); err != nil { -// return err -// } -// -// h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { -// return srv.GetFile(ctx, req.(*pb.GetFileRequest)) -// }) -// out, err := h(ctx, &in) -// if err != nil { -// return err -// } -// reply := out.(*pb.GetFileReply) -// header := ctx.Response().Header() -// header.Set("Content-Length", fmt.Sprint(len(reply.Data))) -// if in.IsRange { -// header.Set("Content-Range", fmt.Sprintf("bytes %d-%d", in.Start, in.End)) -// } -// -// return ctx.Blob(200, reply.Mime, reply.Data) -// } -// } diff --git a/internal/service/directory.go b/internal/service/directory.go new file mode 100755 index 0000000..2fd3729 --- /dev/null +++ b/internal/service/directory.go @@ -0,0 +1,132 @@ +package service + +import ( + "context" + "github.com/go-kratos/kratos/v2/transport/grpc" + "github.com/go-kratos/kratos/v2/transport/http" + "github.com/limes-cloud/kratosx" + "github.com/limes-cloud/kratosx/pkg/valx" + pb "github.com/limes-cloud/resource/api/resource/directory/v1" + "github.com/limes-cloud/resource/api/resource/errors" + "github.com/limes-cloud/resource/internal/biz/directory" + "github.com/limes-cloud/resource/internal/conf" + "github.com/limes-cloud/resource/internal/data" +) + +type DirectoryService struct { + pb.UnimplementedDirectoryServer + uc *directory.UseCase +} + +func NewDirectoryService(conf *conf.Config) *DirectoryService { + return &DirectoryService{ + uc: directory.NewUseCase(conf, data.NewDirectoryRepo()), + } +} + +func init() { + register(func(c *conf.Config, hs *http.Server, gs *grpc.Server) { + srv := NewDirectoryService(c) + pb.RegisterDirectoryHTTPServer(hs, srv) + pb.RegisterDirectoryServer(gs, srv) + }) +} + +// GetDirectory 获取指定的文件目录信息 +func (s *DirectoryService) GetDirectory(c context.Context, req *pb.GetDirectoryRequest) (*pb.GetDirectoryReply, error) { + var ( + in = directory.GetDirectoryRequest{} + ctx = kratosx.MustContext(c) + ) + + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + result, err := s.uc.GetDirectory(ctx, &in) + if err != nil { + return nil, err + } + + reply := pb.GetDirectoryReply{} + if err := valx.Transform(result, &reply); err != nil { + ctx.Logger().Warnw("msg", "reply transform err", "err", err.Error()) + return nil, errors.TransformError() + } + return &reply, nil +} + +// ListDirectory 获取文件目录信息列表 +func (s *DirectoryService) ListDirectory(c context.Context, req *pb.ListDirectoryRequest) (*pb.ListDirectoryReply, error) { + var ( + in = directory.ListDirectoryRequest{} + ctx = kratosx.MustContext(c) + ) + + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + result, total, err := s.uc.ListDirectory(ctx, &in) + if err != nil { + return nil, err + } + + reply := pb.ListDirectoryReply{Total: total} + if err := valx.Transform(result, &reply.List); err != nil { + ctx.Logger().Warnw("msg", "reply transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + return &reply, nil +} + +// CreateDirectory 创建文件目录信息 +func (s *DirectoryService) CreateDirectory(c context.Context, req *pb.CreateDirectoryRequest) (*pb.CreateDirectoryReply, error) { + var ( + in = directory.Directory{} + ctx = kratosx.MustContext(c) + ) + + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + id, err := s.uc.CreateDirectory(ctx, &in) + if err != nil { + return nil, err + } + + return &pb.CreateDirectoryReply{Id: id}, nil +} + +// UpdateDirectory 更新文件目录信息 +func (s *DirectoryService) UpdateDirectory(c context.Context, req *pb.UpdateDirectoryRequest) (*pb.UpdateDirectoryReply, error) { + var ( + in = directory.Directory{} + ctx = kratosx.MustContext(c) + ) + + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + if err := s.uc.UpdateDirectory(ctx, &in); err != nil { + return nil, err + } + + return &pb.UpdateDirectoryReply{}, nil +} + +// DeleteDirectory 删除文件目录信息 +func (s *DirectoryService) DeleteDirectory(c context.Context, req *pb.DeleteDirectoryRequest) (*pb.DeleteDirectoryReply, error) { + total, err := s.uc.DeleteDirectory(kratosx.MustContext(c), req.Ids) + if err != nil { + return nil, err + } + return &pb.DeleteDirectoryReply{Total: total}, nil +} diff --git a/internal/service/entrance.go b/internal/service/entrance.go new file mode 100755 index 0000000..932c9e0 --- /dev/null +++ b/internal/service/entrance.go @@ -0,0 +1,22 @@ +package service + +import ( + "github.com/go-kratos/kratos/v2/transport/grpc" + "github.com/go-kratos/kratos/v2/transport/http" + + "github.com/limes-cloud/resource/internal/conf" +) + +type registryFunc func(c *conf.Config, hs *http.Server, gs *grpc.Server) + +var registries []registryFunc + +func register(fn registryFunc) { + registries = append(registries, fn) +} + +func New(c *conf.Config, hs *http.Server, gs *grpc.Server) { + for _, registry := range registries { + registry(c, hs, gs) + } +} diff --git a/internal/service/export.go b/internal/service/export.go new file mode 100755 index 0000000..fb76f3d --- /dev/null +++ b/internal/service/export.go @@ -0,0 +1,88 @@ +package service + +import ( + "context" + "github.com/go-kratos/kratos/v2/transport/grpc" + "github.com/go-kratos/kratos/v2/transport/http" + "github.com/limes-cloud/kratosx" + "github.com/limes-cloud/kratosx/pkg/valx" + "github.com/limes-cloud/resource/api/resource/errors" + pb "github.com/limes-cloud/resource/api/resource/export/v1" + "github.com/limes-cloud/resource/internal/biz/export" + "github.com/limes-cloud/resource/internal/conf" + "github.com/limes-cloud/resource/internal/data" +) + +type ExportService struct { + pb.UnimplementedExportServer + uc *export.UseCase +} + +func NewExportService(conf *conf.Config) *ExportService { + return &ExportService{ + uc: export.NewUseCase(conf, data.NewExportRepo()), + } +} + +func init() { + register(func(c *conf.Config, hs *http.Server, gs *grpc.Server) { + srv := NewExportService(c) + pb.RegisterExportHTTPServer(hs, srv) + pb.RegisterExportServer(gs, srv) + }) +} + +// ListExport 获取导出信息列表 +func (s *ExportService) ListExport(c context.Context, req *pb.ListExportRequest) (*pb.ListExportReply, error) { + var ( + in = export.ListExportRequest{} + ctx = kratosx.MustContext(c) + ) + + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + result, total, err := s.uc.ListExport(ctx, &in) + if err != nil { + return nil, err + } + + reply := pb.ListExportReply{Total: total} + if err := valx.Transform(result, &reply.List); err != nil { + ctx.Logger().Warnw("msg", "reply transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + return &reply, nil +} + +// CreateExport 创建导出信息 +func (s *ExportService) CreateExport(c context.Context, req *pb.CreateExportRequest) (*pb.CreateExportReply, error) { + var ( + in = export.Export{} + ctx = kratosx.MustContext(c) + ) + + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() + } + + id, err := s.uc.CreateExport(ctx, &in) + if err != nil { + return nil, err + } + + return &pb.CreateExportReply{Id: id}, nil +} + +// DeleteExport 删除导出信息 +func (s *ExportService) DeleteExport(c context.Context, req *pb.DeleteExportRequest) (*pb.DeleteExportReply, error) { + total, err := s.uc.DeleteExport(kratosx.MustContext(c), req.Ids) + if err != nil { + return nil, err + } + return &pb.DeleteExportReply{Total: total}, nil +} diff --git a/internal/service/exports.go b/internal/service/exports.go deleted file mode 100644 index a169ff6..0000000 --- a/internal/service/exports.go +++ /dev/null @@ -1,99 +0,0 @@ -package service - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/limes-cloud/kratosx" - "github.com/limes-cloud/kratosx/pkg/util" - - "github.com/limes-cloud/resource/api/errors" - pb "github.com/limes-cloud/resource/api/export/v1" - biz "github.com/limes-cloud/resource/internal/biz/export" - "github.com/limes-cloud/resource/internal/config" - data "github.com/limes-cloud/resource/internal/data/export" - "github.com/limes-cloud/resource/internal/data/file" - "github.com/limes-cloud/resource/internal/factory" -) - -type ExportService struct { - pb.UnimplementedServiceServer - uc *biz.UseCase - conf *config.Config -} - -func NewExport(conf *config.Config) *ExportService { - return &ExportService{ - conf: conf, - uc: biz.NewUseCase(conf, data.NewRepo(), factory.New(conf, file.NewRepo(), data.NewRepo())), - } -} - -func (fs *ExportService) Config() *config.Config { - return fs.conf -} - -// PageExport 文件分野查询 -func (fs *ExportService) PageExport(ctx context.Context, in *pb.PageExportRequest) (*pb.PageExportReply, error) { - req := biz.PageExportRequest{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - - list, total, err := fs.uc.PageExport(kratosx.MustContext(ctx), &req) - if err != nil { - return nil, err - } - - reply := pb.PageExportReply{Total: &total} - if err := util.Transform(list, &reply.List); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - return &reply, nil -} - -// AddExport 删除文件 -func (fs *ExportService) AddExport(ctx context.Context, in *pb.AddExportRequest) (*pb.AddExportReply, error) { - if len(in.Ids) == 0 && len(in.Files) == 0 { - return nil, errors.Params() - } - req := biz.AddExportRequest{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - id, err := fs.uc.AddExport(kratosx.MustContext(ctx), &req) - if err != nil { - return nil, err - } - return &pb.AddExportReply{ - Id: id, - }, nil -} - -// AddExportExcel 删除文件 -func (fs *ExportService) AddExportExcel(ctx context.Context, in *pb.AddExportExcelRequest) (*pb.AddExportExcelReply, error) { - req := biz.AddExportExcelRequest{Name: in.Name} - for _, row := range in.Rows { - var temp []*biz.ExportExcel - for _, col := range row.Cols { - temp = append(temp, &biz.ExportExcel{ - Type: col.Type, - Value: col.Value, - }) - } - req.Rows = append(req.Rows, temp) - } - - id, err := fs.uc.AddExportExcel(kratosx.MustContext(ctx), &req) - if err != nil { - return nil, err - } - return &pb.AddExportExcelReply{ - Id: id, - }, nil -} - -// DeleteExport 删除文件 -func (fs *ExportService) DeleteExport(ctx context.Context, in *pb.DeleteExportRequest) (*empty.Empty, error) { - return &empty.Empty{}, fs.uc.DeleteExport(kratosx.MustContext(ctx), in.Id) -} diff --git a/internal/service/file.go b/internal/service/file.go old mode 100644 new mode 100755 index 85e0449..8891299 --- a/internal/service/file.go +++ b/internal/service/file.go @@ -3,181 +3,170 @@ package service import ( "context" - "github.com/golang/protobuf/ptypes/empty" + "github.com/go-kratos/kratos/v2/transport/grpc" + "github.com/go-kratos/kratos/v2/transport/http" "github.com/limes-cloud/kratosx" - "github.com/limes-cloud/kratosx/pkg/util" - - "github.com/limes-cloud/resource/api/errors" - pb "github.com/limes-cloud/resource/api/file/v1" - biz "github.com/limes-cloud/resource/internal/biz/file" - "github.com/limes-cloud/resource/internal/config" - "github.com/limes-cloud/resource/internal/data/export" - data "github.com/limes-cloud/resource/internal/data/file" - "github.com/limes-cloud/resource/internal/factory" + "github.com/limes-cloud/kratosx/pkg/valx" + + "github.com/limes-cloud/resource/api/resource/errors" + pb "github.com/limes-cloud/resource/api/resource/file/v1" + "github.com/limes-cloud/resource/internal/biz/file" + "github.com/limes-cloud/resource/internal/conf" + "github.com/limes-cloud/resource/internal/data" ) type FileService struct { - pb.UnimplementedServiceServer - uc *biz.UseCase - conf *config.Config + pb.UnimplementedFileServer + uc *file.UseCase + conf *conf.Config } -func NewFile(conf *config.Config) *FileService { +func NewFileService(conf *conf.Config) *FileService { return &FileService{ + uc: file.NewUseCase(conf, data.NewFileRepo(conf)), conf: conf, - uc: biz.NewUseCase(conf, data.NewRepo(), factory.New(conf, data.NewRepo(), export.NewRepo())), } } -func (fs *FileService) Config() *config.Config { - return fs.conf +func init() { + register(func(c *conf.Config, hs *http.Server, gs *grpc.Server) { + srv := NewFileService(c) + pb.RegisterFileHTTPServer(hs, srv) + pb.RegisterFileServer(gs, srv) + + cr := hs.Route("/") + // cr.GET("/resource/v1/static/export/{src}", srv.SrcBlob()) + cr.GET("/resource/api/v1/static/{expire}/{sign}/{src}", srv.SrcBlob()) + cr.POST("/resource/api/v1/upload", srv.Upload()) + cr.POST("/resource/client/v1/upload", srv.Upload()) + }) } -// AllDirectory 获取目录 -func (fs *FileService) AllDirectory(ctx context.Context, in *pb.AllDirectoryRequest) (*pb.AllDirectoryReply, error) { - list, err := fs.uc.AllDirectoryByParentID(kratosx.MustContext(ctx), in.ParentId, in.App) - if err != nil { - return nil, err - } +// GetFile 获取指定的文件信息 +func (s *FileService) GetFile(c context.Context, req *pb.GetFileRequest) (*pb.GetFileReply, error) { + var ( + in = file.GetFileRequest{} + ctx = kratosx.MustContext(c) + ) - reply := pb.AllDirectoryReply{} - if err := util.Transform(list, &reply.List); err != nil { - return nil, errors.TransformFormat(err.Error()) + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() } - return &reply, nil -} -// AddDirectory 添加目录 -func (fs *FileService) AddDirectory(ctx context.Context, in *pb.AddDirectoryRequest) (*pb.Directory, error) { - req := biz.Directory{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - id, err := fs.uc.AddDirectory(kratosx.MustContext(ctx), &req) + result, err := s.uc.GetFile(ctx, &in) if err != nil { return nil, err } - req.ID = id - reply := pb.Directory{} - if err := util.Transform(req, &reply); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - return &reply, nil -} - -// UpdateDirectory 更新目录 -func (fs *FileService) UpdateDirectory(ctx context.Context, in *pb.UpdateDirectoryRequest) (*empty.Empty, error) { - req := biz.Directory{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) + reply := pb.GetFileReply{} + if err := valx.Transform(result, &reply); err != nil { + ctx.Logger().Warnw("msg", "reply transform err", "err", err.Error()) + return nil, errors.TransformError() } - return nil, fs.uc.UpdateDirectory(kratosx.MustContext(ctx), &req) + return &reply, nil } -// DeleteDirectory 删除目录 -func (fs *FileService) DeleteDirectory(ctx context.Context, in *pb.DeleteDirectoryRequest) (*empty.Empty, error) { - return nil, fs.uc.DeleteDirectory(kratosx.MustContext(ctx), in.Id, in.App) -} +// ListFile 获取文件信息列表 +func (s *FileService) ListFile(c context.Context, req *pb.ListFileRequest) (*pb.ListFileReply, error) { + var ( + in = file.ListFileRequest{} + ctx = kratosx.MustContext(c) + ) -// PrepareUploadFile 文件预上传 -func (fs *FileService) PrepareUploadFile(ctx context.Context, in *pb.PrepareUploadFileRequest) (*pb.PrepareUploadFileReply, error) { - req := biz.PrepareUploadFileRequest{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() } - res, err := fs.uc.PrepareUploadFile(kratosx.MustContext(ctx), &req) + result, total, err := s.uc.ListFile(ctx, &in) if err != nil { return nil, err } - reply := pb.PrepareUploadFileReply{} - if err := util.Transform(res, &reply); err != nil { - return nil, errors.TransformFormat(err.Error()) + reply := pb.ListFileReply{Total: total} + if err := valx.Transform(result, &reply.List); err != nil { + ctx.Logger().Warnw("msg", "reply transform err", "err", err.Error()) + return nil, errors.TransformError() } + return &reply, nil } -// UploadFile 文件上传 -func (fs *FileService) UploadFile(ctx context.Context, in *pb.UploadFileRequest) (*pb.UploadFileReply, error) { - req := biz.UploadFileRequest{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) - } +// PrepareUploadFile 预上传文件信息 +func (s *FileService) PrepareUploadFile(c context.Context, req *pb.PrepareUploadFileRequest) (*pb.PrepareUploadFileReply, error) { + var ( + in = file.PrepareUploadFileRequest{} + ctx = kratosx.MustContext(c) + ) - res, err := fs.uc.UploadFile(kratosx.MustContext(ctx), &req) - if err != nil { - return nil, err + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() } - reply := pb.UploadFileReply{} - if err := util.Transform(res, &reply); err != nil { - return nil, errors.TransformFormat(err.Error()) + if req.DirectoryPath == nil && req.DirectoryId == nil { + return nil, errors.ParamsError() } - return &reply, nil -} -// GetFileBySha 文件查询 -func (fs *FileService) GetFileBySha(ctx context.Context, in *pb.GetFileByShaRequest) (*pb.File, error) { - res, err := fs.uc.GetFileBySha(kratosx.MustContext(ctx), in.Sha) + res, err := s.uc.PrepareUploadFile(ctx, &in) if err != nil { return nil, err } - reply := pb.File{} - if err := util.Transform(res, &reply); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - return &reply, nil + return &pb.PrepareUploadFileReply{ + Uploaded: res.Uploaded, + Src: res.Src, + ChunkSize: res.ChunkSize, + ChunkCount: res.ChunkCount, + UploadId: res.UploadId, + UploadChunks: res.UploadChunks, + Sha: res.Sha, + Url: res.URL, + }, nil } -// PageFile 文件分野查询 -func (fs *FileService) PageFile(ctx context.Context, in *pb.PageFileRequest) (*pb.PageFileReply, error) { - req := biz.PageFileRequest{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - - list, total, err := fs.uc.PageFile(kratosx.MustContext(ctx), &req) +// UploadFile 上传文件信息 +func (s *FileService) UploadFile(c context.Context, req *pb.UploadFileRequest) (*pb.UploadFileReply, error) { + reply, err := s.uc.UploadFile(kratosx.MustContext(c), &file.UploadFileRequest{ + UploadId: req.UploadId, + Index: req.Index, + Data: req.Data, + }) if err != nil { return nil, err } + return &pb.UploadFileReply{ + Src: reply.Src, + Sha: reply.Sha, + Url: reply.URL, + }, nil +} - reply := pb.PageFileReply{Total: &total} - if err := util.Transform(list, &reply.List); err != nil { - return nil, errors.TransformFormat(err.Error()) +// UpdateFile 更新文件信息 +func (s *FileService) UpdateFile(c context.Context, req *pb.UpdateFileRequest) (*pb.UpdateFileReply, error) { + var ( + in = file.File{} + ctx = kratosx.MustContext(c) + ) + + if err := valx.Transform(req, &in); err != nil { + ctx.Logger().Warnw("msg", "req transform err", "err", err.Error()) + return nil, errors.TransformError() } - return &reply, nil -} -// UpdateFile 修改文件 -func (fs *FileService) UpdateFile(ctx context.Context, in *pb.UpdateFileRequest) (*empty.Empty, error) { - req := biz.File{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) + if err := s.uc.UpdateFile(ctx, &in); err != nil { + return nil, err } - return nil, fs.uc.UpdateFile(kratosx.MustContext(ctx), &req) -} -// DeleteFile 删除文件 -func (fs *FileService) DeleteFile(ctx context.Context, in *pb.DeleteFileRequest) (*empty.Empty, error) { - return nil, fs.uc.DeleteFiles(kratosx.MustContext(ctx), in.DirectoryId, in.Ids) + return &pb.UpdateFileReply{}, nil } -// GetFile 获取文件 -func (fs *FileService) GetFile(ctx context.Context, in *pb.GetFileRequest) (*pb.GetFileReply, error) { - req := biz.GetFileRequest{} - if err := util.Transform(in, &req); err != nil { - return nil, errors.TransformFormat(err.Error()) - } - - res, err := fs.uc.GetFile(kratosx.MustContext(ctx), &req) +// DeleteFile 删除文件信息 +func (s *FileService) DeleteFile(c context.Context, req *pb.DeleteFileRequest) (*pb.DeleteFileReply, error) { + total, err := s.uc.DeleteFile(kratosx.MustContext(c), req.Ids) if err != nil { return nil, err } - return &pb.GetFileReply{ - Data: res.Data, - Mime: res.Mime, - }, nil + return &pb.DeleteFileReply{Total: total}, nil } diff --git a/internal/service/service.go b/internal/service/service.go deleted file mode 100644 index 4cf8276..0000000 --- a/internal/service/service.go +++ /dev/null @@ -1,23 +0,0 @@ -package service - -import ( - "github.com/go-kratos/kratos/v2/transport/grpc" - "github.com/go-kratos/kratos/v2/transport/http" - - exportpb "github.com/limes-cloud/resource/api/export/v1" - filepb "github.com/limes-cloud/resource/api/file/v1" - "github.com/limes-cloud/resource/internal/config" -) - -func New(c *config.Config, hs *http.Server, gs *grpc.Server) *FileService { - fileSrv := NewFile(c) - filepb.RegisterServiceHTTPServer(hs, fileSrv) - filepb.RegisterServiceServer(gs, fileSrv) - - exportSrv := NewExport(c) - exportpb.RegisterServiceHTTPServer(hs, exportSrv) - exportpb.RegisterServiceServer(gs, exportSrv) - - // 自定义路由 - return fileSrv -} diff --git a/internal/service/upload.go b/internal/service/upload.go new file mode 100644 index 0000000..578791e --- /dev/null +++ b/internal/service/upload.go @@ -0,0 +1,44 @@ +package service + +import ( + "context" + "io" + + "github.com/go-kratos/kratos/v2/transport/http" + "github.com/limes-cloud/kratosx/pkg/valx" + + "github.com/limes-cloud/resource/api/resource/errors" + pb "github.com/limes-cloud/resource/api/resource/file/v1" +) + +func (s *FileService) Upload() http.HandlerFunc { + return func(ctx http.Context) error { + var in pb.UploadFileRequest + + in.UploadId = ctx.Request().FormValue("uploadId") + in.Index = valx.ToUint32(ctx.Request().FormValue("index")) + file, _, err := ctx.Request().FormFile("data") + if err != nil { + return errors.UploadFileError(err.Error()) + } + + in.Data, err = io.ReadAll(file) + if err != nil { + return errors.UploadFileError(err.Error()) + } + if in.UploadId == "" || int(in.Index) <= 0 || len(in.Data) == 0 { + return errors.ParamsError() + } + + h := ctx.Middleware(func(ctx context.Context, req any) (any, error) { + return s.UploadFile(ctx, req.(*pb.UploadFileRequest)) + }) + + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*pb.UploadFileReply) + return ctx.Result(200, reply) + } +} diff --git a/static/2a0786fe9127b8116bc30ed2ce9581e2.png b/static/2a0786fe9127b8116bc30ed2ce9581e2.png deleted file mode 100755 index c38943e..0000000 Binary files a/static/2a0786fe9127b8116bc30ed2ce9581e2.png and /dev/null differ diff --git a/static/36e2e87f7b73219343da52a28ba47eec.png b/static/36e2e87f7b73219343da52a28ba47eec.png deleted file mode 100755 index 5515377..0000000 Binary files a/static/36e2e87f7b73219343da52a28ba47eec.png and /dev/null differ diff --git a/static/385d37202ae8f08cd8ba429eb51b5422.png b/static/385d37202ae8f08cd8ba429eb51b5422.png new file mode 100755 index 0000000..1688650 Binary files /dev/null and b/static/385d37202ae8f08cd8ba429eb51b5422.png differ diff --git a/static/6d06733ef579fbcef68b9f95745a3e99.png b/static/6d06733ef579fbcef68b9f95745a3e99.png deleted file mode 100755 index 151ba9f..0000000 Binary files a/static/6d06733ef579fbcef68b9f95745a3e99.png and /dev/null differ diff --git a/static/6dc607ee0b87559d8932377d46b9a3ea.png b/static/6dc607ee0b87559d8932377d46b9a3ea.png new file mode 100755 index 0000000..a16c235 Binary files /dev/null and b/static/6dc607ee0b87559d8932377d46b9a3ea.png differ diff --git a/static/b58901a5e27f2f3d7b2b2191608801d43314f4df6ae9e886f572d2c0ed22a0b3.png b/static/b58901a5e27f2f3d7b2b2191608801d43314f4df6ae9e886f572d2c0ed22a0b3.png deleted file mode 100755 index 151ba9f..0000000 Binary files a/static/b58901a5e27f2f3d7b2b2191608801d43314f4df6ae9e886f572d2c0ed22a0b3.png and /dev/null differ diff --git a/static/b8dd9fe625169e3e199064bd5a8d56e4.pdf b/static/b8dd9fe625169e3e199064bd5a8d56e4.pdf deleted file mode 100644 index 46afa33..0000000 Binary files a/static/b8dd9fe625169e3e199064bd5a8d56e4.pdf and /dev/null differ diff --git a/static/d19faa31f4a04b52f802a465edf50d18.png b/static/d19faa31f4a04b52f802a465edf50d18.png new file mode 100755 index 0000000..c85928e Binary files /dev/null and b/static/d19faa31f4a04b52f802a465edf50d18.png differ diff --git a/static/export/1cd9127c5537dcde6b5934d6ad82d785.zip b/static/export/1cd9127c5537dcde6b5934d6ad82d785.zip deleted file mode 100644 index 38694ed..0000000 Binary files a/static/export/1cd9127c5537dcde6b5934d6ad82d785.zip and /dev/null differ diff --git a/static/export/8826bc75ee8096309cb0b12fa6af7a7b.xlsx b/static/export/8826bc75ee8096309cb0b12fa6af7a7b.xlsx deleted file mode 100755 index 0b84234..0000000 Binary files a/static/export/8826bc75ee8096309cb0b12fa6af7a7b.xlsx and /dev/null differ diff --git a/static/export/a4ac0516322a22ab537bc4c1f9ab858a.zip b/static/export/a4ac0516322a22ab537bc4c1f9ab858a.zip deleted file mode 100644 index 38694ed..0000000 Binary files a/static/export/a4ac0516322a22ab537bc4c1f9ab858a.zip and /dev/null differ diff --git a/version.go b/version.go deleted file mode 100644 index 5c84674..0000000 --- a/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package resource - -// Release is the current resource version. -const Release = "v1.0.1"