diff --git a/Makefile b/Makefile index 1376da9..8a5892c 100644 --- a/Makefile +++ b/Makefile @@ -42,11 +42,6 @@ test: ## Run test against code. ##@ Generate -.PHONY: gen-protoc -gen-protoc: ## Run protoc command to generate pb code. - # call gen_proto.sh - ./gen_proto.sh api - .PHONY: tools-install tools-install: ## Install tools. go get -u github.com/golang/protobuf/protoc-gen-go diff --git a/api/README.md b/api/README.md deleted file mode 100644 index 0b42f81..0000000 --- a/api/README.md +++ /dev/null @@ -1 +0,0 @@ -# API Proto diff --git a/api/config/registry/v1/registry.pb.go b/api/config/registry/v1/registry.pb.go deleted file mode 100644 index f487306..0000000 --- a/api/config/registry/v1/registry.pb.go +++ /dev/null @@ -1,416 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.4 -// source: api/config/registry/v1/registry.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" - durationpb "google.golang.org/protobuf/types/known/durationpb" - 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 RegistryInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Addr []string `protobuf:"bytes,1,rep,name=addr,proto3" json:"addr,omitempty"` - Scheme string `protobuf:"bytes,2,opt,name=scheme,proto3" json:"scheme,omitempty"` - // range [10ms, 10s] - DialTimeoutSec *durationpb.Duration `protobuf:"bytes,3,opt,name=dial_timeout_sec,json=dialTimeoutSec,proto3" json:"dial_timeout_sec,omitempty"` - DialKeepAliveTimeSec *durationpb.Duration `protobuf:"bytes,4,opt,name=dial_keep_alive_time_sec,json=dialKeepAliveTimeSec,proto3" json:"dial_keep_alive_time_sec,omitempty"` - DialKeepAliveTimeoutSec *durationpb.Duration `protobuf:"bytes,5,opt,name=dial_keep_alive_timeout_sec,json=dialKeepAliveTimeoutSec,proto3" json:"dial_keep_alive_timeout_sec,omitempty"` -} - -func (x *RegistryInfo) Reset() { - *x = RegistryInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_registry_v1_registry_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegistryInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegistryInfo) ProtoMessage() {} - -func (x *RegistryInfo) ProtoReflect() protoreflect.Message { - mi := &file_api_config_registry_v1_registry_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 RegistryInfo.ProtoReflect.Descriptor instead. -func (*RegistryInfo) Descriptor() ([]byte, []int) { - return file_api_config_registry_v1_registry_proto_rawDescGZIP(), []int{0} -} - -func (x *RegistryInfo) GetAddr() []string { - if x != nil { - return x.Addr - } - return nil -} - -func (x *RegistryInfo) GetScheme() string { - if x != nil { - return x.Scheme - } - return "" -} - -func (x *RegistryInfo) GetDialTimeoutSec() *durationpb.Duration { - if x != nil { - return x.DialTimeoutSec - } - return nil -} - -func (x *RegistryInfo) GetDialKeepAliveTimeSec() *durationpb.Duration { - if x != nil { - return x.DialKeepAliveTimeSec - } - return nil -} - -func (x *RegistryInfo) GetDialKeepAliveTimeoutSec() *durationpb.Duration { - if x != nil { - return x.DialKeepAliveTimeoutSec - } - return nil -} - -type ConfigCenterInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // PathPrefix is prefix key of config center. - PathPrefix string `protobuf:"bytes,1,opt,name=path_prefix,json=pathPrefix,proto3" json:"path_prefix,omitempty"` - // Paths is config paths of config center. - Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"` - // Format is config format of config center. - Format string `protobuf:"bytes,3,opt,name=format,proto3" json:"format,omitempty"` -} - -func (x *ConfigCenterInfo) Reset() { - *x = ConfigCenterInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_registry_v1_registry_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConfigCenterInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConfigCenterInfo) ProtoMessage() {} - -func (x *ConfigCenterInfo) ProtoReflect() protoreflect.Message { - mi := &file_api_config_registry_v1_registry_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 ConfigCenterInfo.ProtoReflect.Descriptor instead. -func (*ConfigCenterInfo) Descriptor() ([]byte, []int) { - return file_api_config_registry_v1_registry_proto_rawDescGZIP(), []int{1} -} - -func (x *ConfigCenterInfo) GetPathPrefix() string { - if x != nil { - return x.PathPrefix - } - return "" -} - -func (x *ConfigCenterInfo) GetPaths() []string { - if x != nil { - return x.Paths - } - return nil -} - -func (x *ConfigCenterInfo) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -type Registry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConfigCenter *ConfigCenterInfo `protobuf:"bytes,1,opt,name=config_center,json=configCenter,proto3" json:"config_center,omitempty"` - // Types that are assignable to Reg: - // *Registry_Consul - // *Registry_Etcd - Reg isRegistry_Reg `protobuf_oneof:"reg"` -} - -func (x *Registry) Reset() { - *x = Registry{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_registry_v1_registry_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Registry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Registry) ProtoMessage() {} - -func (x *Registry) ProtoReflect() protoreflect.Message { - mi := &file_api_config_registry_v1_registry_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 Registry.ProtoReflect.Descriptor instead. -func (*Registry) Descriptor() ([]byte, []int) { - return file_api_config_registry_v1_registry_proto_rawDescGZIP(), []int{2} -} - -func (x *Registry) GetConfigCenter() *ConfigCenterInfo { - if x != nil { - return x.ConfigCenter - } - return nil -} - -func (m *Registry) GetReg() isRegistry_Reg { - if m != nil { - return m.Reg - } - return nil -} - -func (x *Registry) GetConsul() *RegistryInfo { - if x, ok := x.GetReg().(*Registry_Consul); ok { - return x.Consul - } - return nil -} - -func (x *Registry) GetEtcd() *RegistryInfo { - if x, ok := x.GetReg().(*Registry_Etcd); ok { - return x.Etcd - } - return nil -} - -type isRegistry_Reg interface { - isRegistry_Reg() -} - -type Registry_Consul struct { - Consul *RegistryInfo `protobuf:"bytes,2,opt,name=consul,proto3,oneof"` -} - -type Registry_Etcd struct { - Etcd *RegistryInfo `protobuf:"bytes,3,opt,name=etcd,proto3,oneof"` -} - -func (*Registry_Consul) isRegistry_Reg() {} - -func (*Registry_Etcd) isRegistry_Reg() {} - -var File_api_config_registry_v1_registry_proto protoreflect.FileDescriptor - -var file_api_config_registry_v1_registry_proto_rawDesc = []byte{ - 0x0a, 0x25, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x1a, - 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xdc, 0x02, 0x0a, 0x0c, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x04, 0x61, 0x64, 0x64, - 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x92, 0x01, 0x04, 0x08, - 0x01, 0x18, 0x01, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x29, 0x0a, 0x06, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0xfa, 0x42, 0x0e, 0x72, 0x0c, - 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x52, 0x06, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x64, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0xaa, 0x01, - 0x0a, 0x22, 0x02, 0x08, 0x0a, 0x32, 0x04, 0x10, 0xc0, 0x84, 0x3d, 0x52, 0x0e, 0x64, 0x69, 0x61, - 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x12, 0x51, 0x0a, 0x18, 0x64, - 0x69, 0x61, 0x6c, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x14, 0x64, 0x69, 0x61, 0x6c, 0x4b, 0x65, - 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x65, 0x63, 0x12, 0x57, - 0x0a, 0x1b, 0x64, 0x69, 0x61, 0x6c, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, - 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x17, - 0x64, 0x69, 0x61, 0x6c, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, - 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x22, 0x7e, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x70, - 0x61, 0x74, 0x68, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x70, 0x61, 0x74, 0x68, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1e, 0x0a, 0x05, - 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x92, 0x01, 0x02, 0x18, 0x01, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x29, 0x0a, 0x06, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0xfa, 0x42, - 0x0e, 0x72, 0x0c, 0x52, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x52, - 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0xdc, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x72, 0x79, 0x12, 0x4d, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x63, - 0x65, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x43, 0x65, 0x6e, 0x74, 0x65, - 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x43, 0x65, 0x6e, - 0x74, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, 0x63, 0x6f, 0x6e, - 0x73, 0x75, 0x6c, 0x12, 0x3a, 0x0a, 0x04, 0x65, 0x74, 0x63, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x04, 0x65, 0x74, 0x63, 0x64, 0x42, - 0x05, 0x0a, 0x03, 0x72, 0x65, 0x67, 0x42, 0x1b, 0x5a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, - 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_config_registry_v1_registry_proto_rawDescOnce sync.Once - file_api_config_registry_v1_registry_proto_rawDescData = file_api_config_registry_v1_registry_proto_rawDesc -) - -func file_api_config_registry_v1_registry_proto_rawDescGZIP() []byte { - file_api_config_registry_v1_registry_proto_rawDescOnce.Do(func() { - file_api_config_registry_v1_registry_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_config_registry_v1_registry_proto_rawDescData) - }) - return file_api_config_registry_v1_registry_proto_rawDescData -} - -var file_api_config_registry_v1_registry_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_api_config_registry_v1_registry_proto_goTypes = []interface{}{ - (*RegistryInfo)(nil), // 0: api.config.registry.v1.RegistryInfo - (*ConfigCenterInfo)(nil), // 1: api.config.registry.v1.ConfigCenterInfo - (*Registry)(nil), // 2: api.config.registry.v1.Registry - (*durationpb.Duration)(nil), // 3: google.protobuf.Duration -} -var file_api_config_registry_v1_registry_proto_depIdxs = []int32{ - 3, // 0: api.config.registry.v1.RegistryInfo.dial_timeout_sec:type_name -> google.protobuf.Duration - 3, // 1: api.config.registry.v1.RegistryInfo.dial_keep_alive_time_sec:type_name -> google.protobuf.Duration - 3, // 2: api.config.registry.v1.RegistryInfo.dial_keep_alive_timeout_sec:type_name -> google.protobuf.Duration - 1, // 3: api.config.registry.v1.Registry.config_center:type_name -> api.config.registry.v1.ConfigCenterInfo - 0, // 4: api.config.registry.v1.Registry.consul:type_name -> api.config.registry.v1.RegistryInfo - 0, // 5: api.config.registry.v1.Registry.etcd:type_name -> api.config.registry.v1.RegistryInfo - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_api_config_registry_v1_registry_proto_init() } -func file_api_config_registry_v1_registry_proto_init() { - if File_api_config_registry_v1_registry_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_config_registry_v1_registry_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegistryInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_config_registry_v1_registry_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConfigCenterInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_config_registry_v1_registry_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Registry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_api_config_registry_v1_registry_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*Registry_Consul)(nil), - (*Registry_Etcd)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_config_registry_v1_registry_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_api_config_registry_v1_registry_proto_goTypes, - DependencyIndexes: file_api_config_registry_v1_registry_proto_depIdxs, - MessageInfos: file_api_config_registry_v1_registry_proto_msgTypes, - }.Build() - File_api_config_registry_v1_registry_proto = out.File - file_api_config_registry_v1_registry_proto_rawDesc = nil - file_api_config_registry_v1_registry_proto_goTypes = nil - file_api_config_registry_v1_registry_proto_depIdxs = nil -} diff --git a/api/config/registry/v1/registry.pb.validate.go b/api/config/registry/v1/registry.pb.validate.go deleted file mode 100644 index 8a67b27..0000000 --- a/api/config/registry/v1/registry.pb.validate.go +++ /dev/null @@ -1,605 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: api/config/registry/v1/registry.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 RegistryInfo 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 *RegistryInfo) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RegistryInfo 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 RegistryInfoMultiError, or -// nil if none found. -func (m *RegistryInfo) ValidateAll() error { - return m.validate(true) -} - -func (m *RegistryInfo) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(m.GetAddr()) < 1 { - err := RegistryInfoValidationError{ - field: "Addr", - reason: "value must contain at least 1 item(s)", - } - if !all { - return err - } - errors = append(errors, err) - } - - _RegistryInfo_Addr_Unique := make(map[string]struct{}, len(m.GetAddr())) - - for idx, item := range m.GetAddr() { - _, _ = idx, item - - if _, exists := _RegistryInfo_Addr_Unique[item]; exists { - err := RegistryInfoValidationError{ - field: fmt.Sprintf("Addr[%v]", idx), - reason: "repeated value must contain unique items", - } - if !all { - return err - } - errors = append(errors, err) - } else { - _RegistryInfo_Addr_Unique[item] = struct{}{} - } - - // no validation rules for Addr[idx] - } - - if _, ok := _RegistryInfo_Scheme_InLookup[m.GetScheme()]; !ok { - err := RegistryInfoValidationError{ - field: "Scheme", - reason: "value must be in list [http grpc]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetDialTimeoutSec(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = RegistryInfoValidationError{ - field: "DialTimeoutSec", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(10*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte || dur > lte { - err := RegistryInfoValidationError{ - field: "DialTimeoutSec", - reason: "value must be inside range [1ms, 10s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if all { - switch v := interface{}(m.GetDialKeepAliveTimeSec()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegistryInfoValidationError{ - field: "DialKeepAliveTimeSec", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegistryInfoValidationError{ - field: "DialKeepAliveTimeSec", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDialKeepAliveTimeSec()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegistryInfoValidationError{ - field: "DialKeepAliveTimeSec", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetDialKeepAliveTimeoutSec()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegistryInfoValidationError{ - field: "DialKeepAliveTimeoutSec", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegistryInfoValidationError{ - field: "DialKeepAliveTimeoutSec", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDialKeepAliveTimeoutSec()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegistryInfoValidationError{ - field: "DialKeepAliveTimeoutSec", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RegistryInfoMultiError(errors) - } - - return nil -} - -// RegistryInfoMultiError is an error wrapping multiple validation errors -// returned by RegistryInfo.ValidateAll() if the designated constraints aren't met. -type RegistryInfoMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegistryInfoMultiError) 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 RegistryInfoMultiError) AllErrors() []error { return m } - -// RegistryInfoValidationError is the validation error returned by -// RegistryInfo.Validate if the designated constraints aren't met. -type RegistryInfoValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegistryInfoValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegistryInfoValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegistryInfoValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegistryInfoValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegistryInfoValidationError) ErrorName() string { return "RegistryInfoValidationError" } - -// Error satisfies the builtin error interface -func (e RegistryInfoValidationError) 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 %sRegistryInfo.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegistryInfoValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegistryInfoValidationError{} - -var _RegistryInfo_Scheme_InLookup = map[string]struct{}{ - "http": {}, - "grpc": {}, -} - -// Validate checks the field values on ConfigCenterInfo 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 *ConfigCenterInfo) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ConfigCenterInfo 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 -// ConfigCenterInfoMultiError, or nil if none found. -func (m *ConfigCenterInfo) ValidateAll() error { - return m.validate(true) -} - -func (m *ConfigCenterInfo) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for PathPrefix - - _ConfigCenterInfo_Paths_Unique := make(map[string]struct{}, len(m.GetPaths())) - - for idx, item := range m.GetPaths() { - _, _ = idx, item - - if _, exists := _ConfigCenterInfo_Paths_Unique[item]; exists { - err := ConfigCenterInfoValidationError{ - field: fmt.Sprintf("Paths[%v]", idx), - reason: "repeated value must contain unique items", - } - if !all { - return err - } - errors = append(errors, err) - } else { - _ConfigCenterInfo_Paths_Unique[item] = struct{}{} - } - - // no validation rules for Paths[idx] - } - - if _, ok := _ConfigCenterInfo_Format_InLookup[m.GetFormat()]; !ok { - err := ConfigCenterInfoValidationError{ - field: "Format", - reason: "value must be in list [json yaml]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ConfigCenterInfoMultiError(errors) - } - - return nil -} - -// ConfigCenterInfoMultiError is an error wrapping multiple validation errors -// returned by ConfigCenterInfo.ValidateAll() if the designated constraints -// aren't met. -type ConfigCenterInfoMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ConfigCenterInfoMultiError) 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 ConfigCenterInfoMultiError) AllErrors() []error { return m } - -// ConfigCenterInfoValidationError is the validation error returned by -// ConfigCenterInfo.Validate if the designated constraints aren't met. -type ConfigCenterInfoValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ConfigCenterInfoValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ConfigCenterInfoValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ConfigCenterInfoValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ConfigCenterInfoValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ConfigCenterInfoValidationError) ErrorName() string { return "ConfigCenterInfoValidationError" } - -// Error satisfies the builtin error interface -func (e ConfigCenterInfoValidationError) 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 %sConfigCenterInfo.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ConfigCenterInfoValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ConfigCenterInfoValidationError{} - -var _ConfigCenterInfo_Format_InLookup = map[string]struct{}{ - "json": {}, - "yaml": {}, -} - -// Validate checks the field values on Registry 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 *Registry) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Registry 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 RegistryMultiError, or nil -// if none found. -func (m *Registry) ValidateAll() error { - return m.validate(true) -} - -func (m *Registry) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetConfigCenter()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegistryValidationError{ - field: "ConfigCenter", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegistryValidationError{ - field: "ConfigCenter", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfigCenter()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegistryValidationError{ - field: "ConfigCenter", - reason: "embedded message failed validation", - cause: err, - } - } - } - - switch m.Reg.(type) { - - case *Registry_Consul: - - if all { - switch v := interface{}(m.GetConsul()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegistryValidationError{ - field: "Consul", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegistryValidationError{ - field: "Consul", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConsul()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegistryValidationError{ - field: "Consul", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Registry_Etcd: - - if all { - switch v := interface{}(m.GetEtcd()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RegistryValidationError{ - field: "Etcd", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RegistryValidationError{ - field: "Etcd", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEtcd()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RegistryValidationError{ - field: "Etcd", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return RegistryMultiError(errors) - } - - return nil -} - -// RegistryMultiError is an error wrapping multiple validation errors returned -// by Registry.ValidateAll() if the designated constraints aren't met. -type RegistryMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RegistryMultiError) 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 RegistryMultiError) AllErrors() []error { return m } - -// RegistryValidationError is the validation error returned by -// Registry.Validate if the designated constraints aren't met. -type RegistryValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RegistryValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RegistryValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RegistryValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RegistryValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RegistryValidationError) ErrorName() string { return "RegistryValidationError" } - -// Error satisfies the builtin error interface -func (e RegistryValidationError) 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 %sRegistry.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RegistryValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RegistryValidationError{} diff --git a/api/config/registry/v1/registry.proto b/api/config/registry/v1/registry.proto deleted file mode 100644 index f802daf..0000000 --- a/api/config/registry/v1/registry.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -package api.config.registry.v1; -option go_package = "api/config/registry/v1;v1"; - -import "google/protobuf/duration.proto"; - -import "validate/validate.proto"; - -message RegistryInfo { - repeated string addr = 1 [(validate.rules).repeated = { - min_items: 1, - unique: true, - }]; - string scheme = 2 [(validate.rules).string = {in: ["http", "grpc"]}]; - // range [10ms, 10s] - google.protobuf.Duration dial_timeout_sec = 3 [(validate.rules).duration = { - gte: {nanos: 1000000, seconds: 0}, - lte: {seconds: 10} - }]; - google.protobuf.Duration dial_keep_alive_time_sec = 4; - google.protobuf.Duration dial_keep_alive_timeout_sec = 5; -} - -message ConfigCenterInfo { - // PathPrefix is prefix key of config center. - string path_prefix = 1; - // Paths is config paths of config center. - repeated string paths = 2 [(validate.rules).repeated = {unique: true}]; - // Format is config format of config center. - string format = 3 [(validate.rules).string = {in: ["json", "yaml"]}]; -} - -message Registry { - ConfigCenterInfo config_center = 1; - oneof reg { - RegistryInfo consul = 2; - RegistryInfo etcd = 3; - } -} diff --git a/api/config/v1/config.pb.go b/api/config/v1/config.pb.go deleted file mode 100644 index 34b103d..0000000 --- a/api/config/v1/config.pb.go +++ /dev/null @@ -1,883 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.4 -// source: api/config/v1/config.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" - durationpb "google.golang.org/protobuf/types/known/durationpb" - 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 Level int32 - -const ( - Level_DEBUG Level = 0 - Level_INFO Level = 1 - Level_WARNING Level = 2 - Level_ERROR Level = 3 - Level_FATAL Level = 4 -) - -// Enum value maps for Level. -var ( - Level_name = map[int32]string{ - 0: "DEBUG", - 1: "INFO", - 2: "WARNING", - 3: "ERROR", - 4: "FATAL", - } - Level_value = map[string]int32{ - "DEBUG": 0, - "INFO": 1, - "WARNING": 2, - "ERROR": 3, - "FATAL": 4, - } -) - -func (x Level) Enum() *Level { - p := new(Level) - *p = x - return p -} - -func (x Level) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Level) Descriptor() protoreflect.EnumDescriptor { - return file_api_config_v1_config_proto_enumTypes[0].Descriptor() -} - -func (Level) Type() protoreflect.EnumType { - return &file_api_config_v1_config_proto_enumTypes[0] -} - -func (x Level) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Level.Descriptor instead. -func (Level) EnumDescriptor() ([]byte, []int) { - return file_api_config_v1_config_proto_rawDescGZIP(), []int{0} -} - -type Server struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Scheme string `protobuf:"bytes,1,opt,name=scheme,proto3" json:"scheme,omitempty"` - Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` - // range:[10ms, 10s] - Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` -} - -func (x *Server) Reset() { - *x = Server{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_v1_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Server) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Server) ProtoMessage() {} - -func (x *Server) ProtoReflect() protoreflect.Message { - mi := &file_api_config_v1_config_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 Server.ProtoReflect.Descriptor instead. -func (*Server) Descriptor() ([]byte, []int) { - return file_api_config_v1_config_proto_rawDescGZIP(), []int{0} -} - -func (x *Server) GetScheme() string { - if x != nil { - return x.Scheme - } - return "" -} - -func (x *Server) GetPort() int32 { - if x != nil { - return x.Port - } - return 0 -} - -func (x *Server) GetTimeout() *durationpb.Duration { - if x != nil { - return x.Timeout - } - return nil -} - -type Service struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Http *Server `protobuf:"bytes,3,opt,name=http,proto3,oneof" json:"http,omitempty"` - Grpc *Server `protobuf:"bytes,4,opt,name=grpc,proto3,oneof" json:"grpc,omitempty"` - Log *Log `protobuf:"bytes,5,opt,name=log,proto3" json:"log,omitempty"` - Metadata map[string]string `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Redis *Redis `protobuf:"bytes,7,opt,name=redis,proto3" json:"redis,omitempty"` - Mq *MQ `protobuf:"bytes,8,opt,name=mq,proto3" json:"mq,omitempty"` - Mysql *MySQL `protobuf:"bytes,9,opt,name=mysql,proto3" json:"mysql,omitempty"` - // services name - GatewayService string `protobuf:"bytes,10,opt,name=gatewayService,proto3" json:"gatewayService,omitempty"` - UserService string `protobuf:"bytes,11,opt,name=userService,proto3" json:"userService,omitempty"` - PushService string `protobuf:"bytes,12,opt,name=pushService,proto3" json:"pushService,omitempty"` - StoreService string `protobuf:"bytes,13,opt,name=storeService,proto3" json:"storeService,omitempty"` - MsgService string `protobuf:"bytes,14,opt,name=msgService,proto3" json:"msgService,omitempty"` -} - -func (x *Service) Reset() { - *x = Service{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_v1_config_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Service) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Service) ProtoMessage() {} - -func (x *Service) ProtoReflect() protoreflect.Message { - mi := &file_api_config_v1_config_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 Service.ProtoReflect.Descriptor instead. -func (*Service) Descriptor() ([]byte, []int) { - return file_api_config_v1_config_proto_rawDescGZIP(), []int{1} -} - -func (x *Service) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Service) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Service) GetHttp() *Server { - if x != nil { - return x.Http - } - return nil -} - -func (x *Service) GetGrpc() *Server { - if x != nil { - return x.Grpc - } - return nil -} - -func (x *Service) GetLog() *Log { - if x != nil { - return x.Log - } - return nil -} - -func (x *Service) GetMetadata() map[string]string { - if x != nil { - return x.Metadata - } - return nil -} - -func (x *Service) GetRedis() *Redis { - if x != nil { - return x.Redis - } - return nil -} - -func (x *Service) GetMq() *MQ { - if x != nil { - return x.Mq - } - return nil -} - -func (x *Service) GetMysql() *MySQL { - if x != nil { - return x.Mysql - } - return nil -} - -func (x *Service) GetGatewayService() string { - if x != nil { - return x.GatewayService - } - return "" -} - -func (x *Service) GetUserService() string { - if x != nil { - return x.UserService - } - return "" -} - -func (x *Service) GetPushService() string { - if x != nil { - return x.PushService - } - return "" -} - -func (x *Service) GetStoreService() string { - if x != nil { - return x.StoreService - } - return "" -} - -func (x *Service) GetMsgService() string { - if x != nil { - return x.MsgService - } - return "" -} - -type Log struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LogPath *string `protobuf:"bytes,1,opt,name=log_path,json=logPath,proto3,oneof" json:"log_path,omitempty"` - Level Level `protobuf:"varint,2,opt,name=level,proto3,enum=api.config.v1.Level" json:"level,omitempty"` - EnableConsole bool `protobuf:"varint,3,opt,name=enable_console,json=enableConsole,proto3" json:"enable_console,omitempty"` -} - -func (x *Log) Reset() { - *x = Log{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_v1_config_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Log) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Log) ProtoMessage() {} - -func (x *Log) ProtoReflect() protoreflect.Message { - mi := &file_api_config_v1_config_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 Log.ProtoReflect.Descriptor instead. -func (*Log) Descriptor() ([]byte, []int) { - return file_api_config_v1_config_proto_rawDescGZIP(), []int{2} -} - -func (x *Log) GetLogPath() string { - if x != nil && x.LogPath != nil { - return *x.LogPath - } - return "" -} - -func (x *Log) GetLevel() Level { - if x != nil { - return x.Level - } - return Level_DEBUG -} - -func (x *Log) GetEnableConsole() bool { - if x != nil { - return x.EnableConsole - } - return false -} - -type Redis struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - MaxConns int32 `protobuf:"varint,3,opt,name=max_conns,json=maxConns,proto3" json:"max_conns,omitempty"` - MinIdleConns int32 `protobuf:"varint,4,opt,name=min_idle_conns,json=minIdleConns,proto3" json:"min_idle_conns,omitempty"` - // range: [10ms,10s] - DialTimeout *durationpb.Duration `protobuf:"bytes,5,opt,name=dial_timeout,json=dialTimeout,proto3" json:"dial_timeout,omitempty"` - // range: [10ms,10s] - IdleTimeout *durationpb.Duration `protobuf:"bytes,6,opt,name=idle_timeout,json=idleTimeout,proto3" json:"idle_timeout,omitempty"` -} - -func (x *Redis) Reset() { - *x = Redis{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_v1_config_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Redis) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Redis) ProtoMessage() {} - -func (x *Redis) ProtoReflect() protoreflect.Message { - mi := &file_api_config_v1_config_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 Redis.ProtoReflect.Descriptor instead. -func (*Redis) Descriptor() ([]byte, []int) { - return file_api_config_v1_config_proto_rawDescGZIP(), []int{3} -} - -func (x *Redis) GetAddr() string { - if x != nil { - return x.Addr - } - return "" -} - -func (x *Redis) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *Redis) GetMaxConns() int32 { - if x != nil { - return x.MaxConns - } - return 0 -} - -func (x *Redis) GetMinIdleConns() int32 { - if x != nil { - return x.MinIdleConns - } - return 0 -} - -func (x *Redis) GetDialTimeout() *durationpb.Duration { - if x != nil { - return x.DialTimeout - } - return nil -} - -func (x *Redis) GetIdleTimeout() *durationpb.Duration { - if x != nil { - return x.IdleTimeout - } - return nil -} - -type MQ struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Addr []string `protobuf:"bytes,1,rep,name=addr,proto3" json:"addr,omitempty"` - MaxRetry int32 `protobuf:"varint,2,opt,name=max_retry,json=maxRetry,proto3" json:"max_retry,omitempty"` -} - -func (x *MQ) Reset() { - *x = MQ{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_v1_config_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MQ) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MQ) ProtoMessage() {} - -func (x *MQ) ProtoReflect() protoreflect.Message { - mi := &file_api_config_v1_config_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 MQ.ProtoReflect.Descriptor instead. -func (*MQ) Descriptor() ([]byte, []int) { - return file_api_config_v1_config_proto_rawDescGZIP(), []int{4} -} - -func (x *MQ) GetAddr() []string { - if x != nil { - return x.Addr - } - return nil -} - -func (x *MQ) GetMaxRetry() int32 { - if x != nil { - return x.MaxRetry - } - return 0 -} - -type MySQL struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` - User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` - Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` - Db string `protobuf:"bytes,4,opt,name=db,proto3" json:"db,omitempty"` - MaxIdleConns int32 `protobuf:"varint,5,opt,name=max_idle_conns,json=maxIdleConns,proto3" json:"max_idle_conns,omitempty"` - MaxOpenConns int32 `protobuf:"varint,6,opt,name=max_open_conns,json=maxOpenConns,proto3" json:"max_open_conns,omitempty"` - // range: [10ms,10s] - IdleTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=idle_timeout,json=idleTimeout,proto3" json:"idle_timeout,omitempty"` - // range: [10ms,10s] - OpenTimeout *durationpb.Duration `protobuf:"bytes,8,opt,name=open_timeout,json=openTimeout,proto3" json:"open_timeout,omitempty"` -} - -func (x *MySQL) Reset() { - *x = MySQL{} - if protoimpl.UnsafeEnabled { - mi := &file_api_config_v1_config_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MySQL) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MySQL) ProtoMessage() {} - -func (x *MySQL) ProtoReflect() protoreflect.Message { - mi := &file_api_config_v1_config_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 MySQL.ProtoReflect.Descriptor instead. -func (*MySQL) Descriptor() ([]byte, []int) { - return file_api_config_v1_config_proto_rawDescGZIP(), []int{5} -} - -func (x *MySQL) GetAddr() string { - if x != nil { - return x.Addr - } - return "" -} - -func (x *MySQL) GetUser() string { - if x != nil { - return x.User - } - return "" -} - -func (x *MySQL) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *MySQL) GetDb() string { - if x != nil { - return x.Db - } - return "" -} - -func (x *MySQL) GetMaxIdleConns() int32 { - if x != nil { - return x.MaxIdleConns - } - return 0 -} - -func (x *MySQL) GetMaxOpenConns() int32 { - if x != nil { - return x.MaxOpenConns - } - return 0 -} - -func (x *MySQL) GetIdleTimeout() *durationpb.Duration { - if x != nil { - return x.IdleTimeout - } - return nil -} - -func (x *MySQL) GetOpenTimeout() *durationpb.Duration { - if x != nil { - return x.OpenTimeout - } - return nil -} - -var File_api_config_v1_config_proto protoreflect.FileDescriptor - -var file_api_config_v1_config_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 0x2f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x61, 0x70, - 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xa2, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, - 0x2e, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x16, 0xfa, 0x42, 0x13, 0x72, 0x11, 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, 0x52, 0x04, 0x67, 0x72, - 0x70, 0x63, 0x52, 0x03, 0x74, 0x63, 0x70, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, - 0x20, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0c, 0xfa, - 0x42, 0x09, 0x1a, 0x07, 0x10, 0xf7, 0xd8, 0x03, 0x20, 0x90, 0x4e, 0x52, 0x04, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x46, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, 0xfa, - 0x42, 0x0e, 0xaa, 0x01, 0x0b, 0x22, 0x02, 0x08, 0x0a, 0x32, 0x05, 0x10, 0x80, 0xad, 0xe2, 0x04, - 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x9c, 0x06, 0x0a, 0x07, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x13, 0xfa, 0x42, 0x10, 0x72, 0x0e, 0x3a, 0x0c, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x67, 0x6f, 0x69, 0x6d, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, - 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x68, 0x74, 0x74, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x48, 0x00, 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, 0x88, 0x01, - 0x01, 0x12, 0x2e, 0x0a, 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x48, 0x01, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x88, 0x01, - 0x01, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4c, - 0x6f, 0x67, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x40, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x05, 0x72, 0x65, 0x64, - 0x69, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x52, 0x05, - 0x72, 0x65, 0x64, 0x69, 0x73, 0x12, 0x21, 0x0a, 0x02, 0x6d, 0x71, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x51, 0x52, 0x02, 0x6d, 0x71, 0x12, 0x2a, 0x0a, 0x05, 0x6d, 0x79, 0x73, 0x71, - 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x52, 0x05, 0x6d, - 0x79, 0x73, 0x71, 0x6c, 0x12, 0x43, 0x0a, 0x0e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1b, 0xfa, 0x42, - 0x18, 0x72, 0x16, 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x67, 0x6f, 0x69, - 0x6d, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x0e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x75, 0x73, 0x65, - 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, - 0xfa, 0x42, 0x15, 0x72, 0x13, 0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x67, - 0x6f, 0x69, 0x6d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x75, 0x73, 0x68, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xfa, 0x42, 0x15, 0x72, - 0x13, 0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x67, 0x6f, 0x69, 0x6d, 0x2e, - 0x70, 0x75, 0x73, 0x68, 0x52, 0x0b, 0x70, 0x75, 0x73, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0xfa, 0x42, 0x16, 0x72, 0x14, 0x0a, 0x12, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x67, 0x6f, 0x69, 0x6d, 0x2e, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x73, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x0e, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xfa, 0x42, 0x14, 0x72, 0x12, 0x0a, 0x10, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x67, 0x6f, 0x69, 0x6d, 0x2e, 0x6d, 0x73, 0x67, 0x52, 0x0a, 0x6d, - 0x73, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x22, 0x8f, 0x01, 0x0a, 0x03, 0x4c, 0x6f, 0x67, - 0x12, 0x1e, 0x0a, 0x08, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6c, 0x6f, 0x67, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x12, 0x34, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x42, 0x0b, 0x0a, - 0x09, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x22, 0x9c, 0x02, 0x0a, 0x05, 0x52, - 0x65, 0x64, 0x69, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x6e, - 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x63, 0x6f, - 0x6e, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x69, 0x6e, 0x49, 0x64, - 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x4f, 0x0a, 0x0c, 0x64, 0x69, 0x61, 0x6c, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, 0xfa, 0x42, 0x0e, 0xaa, 0x01, 0x0b, - 0x22, 0x02, 0x08, 0x0a, 0x32, 0x05, 0x10, 0x80, 0xad, 0xe2, 0x04, 0x52, 0x0b, 0x64, 0x69, 0x61, - 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x4f, 0x0a, 0x0c, 0x69, 0x64, 0x6c, 0x65, - 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, 0xfa, 0x42, 0x0e, 0xaa, 0x01, - 0x0b, 0x22, 0x02, 0x08, 0x0a, 0x32, 0x05, 0x10, 0x80, 0xad, 0xe2, 0x04, 0x52, 0x0b, 0x69, 0x64, - 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x35, 0x0a, 0x02, 0x4d, 0x51, 0x12, - 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, - 0x64, 0x64, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x52, 0x65, 0x74, 0x72, 0x79, - 0x22, 0xc7, 0x02, 0x0a, 0x05, 0x4d, 0x79, 0x53, 0x51, 0x4c, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, - 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, - 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, - 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x0e, - 0x0a, 0x02, 0x64, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x64, 0x62, 0x12, 0x24, - 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x43, - 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x6f, 0x70, 0x65, 0x6e, - 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, - 0x78, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x4e, 0x0a, 0x0c, 0x69, 0x64, - 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x10, 0xfa, 0x42, 0x0d, - 0xaa, 0x01, 0x0a, 0x22, 0x02, 0x08, 0x0a, 0x32, 0x04, 0x10, 0xc0, 0x84, 0x3d, 0x52, 0x0b, 0x69, - 0x64, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x4e, 0x0a, 0x0c, 0x6f, 0x70, - 0x65, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x10, 0xfa, 0x42, 0x0d, - 0xaa, 0x01, 0x0a, 0x22, 0x02, 0x08, 0x0a, 0x32, 0x04, 0x10, 0xc0, 0x84, 0x3d, 0x52, 0x0b, 0x6f, - 0x70, 0x65, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x2a, 0x3f, 0x0a, 0x05, 0x4c, 0x65, - 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x00, 0x12, 0x08, - 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, - 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, - 0x12, 0x09, 0x0a, 0x05, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x04, 0x42, 0x12, 0x5a, 0x10, 0x61, - 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_config_v1_config_proto_rawDescOnce sync.Once - file_api_config_v1_config_proto_rawDescData = file_api_config_v1_config_proto_rawDesc -) - -func file_api_config_v1_config_proto_rawDescGZIP() []byte { - file_api_config_v1_config_proto_rawDescOnce.Do(func() { - file_api_config_v1_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_config_v1_config_proto_rawDescData) - }) - return file_api_config_v1_config_proto_rawDescData -} - -var file_api_config_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_api_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_api_config_v1_config_proto_goTypes = []interface{}{ - (Level)(0), // 0: api.config.v1.Level - (*Server)(nil), // 1: api.config.v1.Server - (*Service)(nil), // 2: api.config.v1.Service - (*Log)(nil), // 3: api.config.v1.Log - (*Redis)(nil), // 4: api.config.v1.Redis - (*MQ)(nil), // 5: api.config.v1.MQ - (*MySQL)(nil), // 6: api.config.v1.MySQL - nil, // 7: api.config.v1.Service.MetadataEntry - (*durationpb.Duration)(nil), // 8: google.protobuf.Duration -} -var file_api_config_v1_config_proto_depIdxs = []int32{ - 8, // 0: api.config.v1.Server.timeout:type_name -> google.protobuf.Duration - 1, // 1: api.config.v1.Service.http:type_name -> api.config.v1.Server - 1, // 2: api.config.v1.Service.grpc:type_name -> api.config.v1.Server - 3, // 3: api.config.v1.Service.log:type_name -> api.config.v1.Log - 7, // 4: api.config.v1.Service.metadata:type_name -> api.config.v1.Service.MetadataEntry - 4, // 5: api.config.v1.Service.redis:type_name -> api.config.v1.Redis - 5, // 6: api.config.v1.Service.mq:type_name -> api.config.v1.MQ - 6, // 7: api.config.v1.Service.mysql:type_name -> api.config.v1.MySQL - 0, // 8: api.config.v1.Log.level:type_name -> api.config.v1.Level - 8, // 9: api.config.v1.Redis.dial_timeout:type_name -> google.protobuf.Duration - 8, // 10: api.config.v1.Redis.idle_timeout:type_name -> google.protobuf.Duration - 8, // 11: api.config.v1.MySQL.idle_timeout:type_name -> google.protobuf.Duration - 8, // 12: api.config.v1.MySQL.open_timeout:type_name -> google.protobuf.Duration - 13, // [13:13] is the sub-list for method output_type - 13, // [13:13] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name -} - -func init() { file_api_config_v1_config_proto_init() } -func file_api_config_v1_config_proto_init() { - if File_api_config_v1_config_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_config_v1_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Server); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_config_v1_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Service); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_config_v1_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Log); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_config_v1_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Redis); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_config_v1_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MQ); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_config_v1_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MySQL); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_api_config_v1_config_proto_msgTypes[1].OneofWrappers = []interface{}{} - file_api_config_v1_config_proto_msgTypes[2].OneofWrappers = []interface{}{} - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_config_v1_config_proto_rawDesc, - NumEnums: 1, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_api_config_v1_config_proto_goTypes, - DependencyIndexes: file_api_config_v1_config_proto_depIdxs, - EnumInfos: file_api_config_v1_config_proto_enumTypes, - MessageInfos: file_api_config_v1_config_proto_msgTypes, - }.Build() - File_api_config_v1_config_proto = out.File - file_api_config_v1_config_proto_rawDesc = nil - file_api_config_v1_config_proto_goTypes = nil - file_api_config_v1_config_proto_depIdxs = nil -} diff --git a/api/config/v1/config.pb.validate.go b/api/config/v1/config.pb.validate.go deleted file mode 100644 index f0cbe25..0000000 --- a/api/config/v1/config.pb.validate.go +++ /dev/null @@ -1,1107 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: api/config/v1/config.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 Server 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 *Server) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Server 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 ServerMultiError, or nil if none found. -func (m *Server) ValidateAll() error { - return m.validate(true) -} - -func (m *Server) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := _Server_Scheme_InLookup[m.GetScheme()]; !ok { - err := ServerValidationError{ - field: "Scheme", - reason: "value must be in list [http grpc tcp]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if val := m.GetPort(); val <= 10000 || val >= 60535 { - err := ServerValidationError{ - field: "Port", - reason: "value must be inside range (10000, 60535)", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = ServerValidationError{ - field: "Timeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(10*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 10000000*time.Nanosecond) - - if dur < gte || dur > lte { - err := ServerValidationError{ - field: "Timeout", - reason: "value must be inside range [10ms, 10s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return ServerMultiError(errors) - } - - return nil -} - -// ServerMultiError is an error wrapping multiple validation errors returned by -// Server.ValidateAll() if the designated constraints aren't met. -type ServerMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ServerMultiError) 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 ServerMultiError) AllErrors() []error { return m } - -// ServerValidationError is the validation error returned by Server.Validate if -// the designated constraints aren't met. -type ServerValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ServerValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ServerValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ServerValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ServerValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ServerValidationError) ErrorName() string { return "ServerValidationError" } - -// Error satisfies the builtin error interface -func (e ServerValidationError) 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 %sServer.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ServerValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ServerValidationError{} - -var _Server_Scheme_InLookup = map[string]struct{}{ - "http": {}, - "grpc": {}, - "tcp": {}, -} - -// Validate checks the field values on Service 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 *Service) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Service 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 ServiceMultiError, or nil if none found. -func (m *Service) ValidateAll() error { - return m.validate(true) -} - -func (m *Service) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if !strings.HasPrefix(m.GetName(), "service.goim") { - err := ServiceValidationError{ - field: "Name", - reason: "value does not have prefix \"service.goim\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetVersion()) < 1 { - err := ServiceValidationError{ - field: "Version", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetLog()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Log", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Log", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLog()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServiceValidationError{ - field: "Log", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Metadata - - if all { - switch v := interface{}(m.GetRedis()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Redis", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Redis", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRedis()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServiceValidationError{ - field: "Redis", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMq()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Mq", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Mq", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMq()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServiceValidationError{ - field: "Mq", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMysql()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Mysql", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Mysql", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMysql()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServiceValidationError{ - field: "Mysql", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetGatewayService() != "service.goim.gateway" { - err := ServiceValidationError{ - field: "GatewayService", - reason: "value must equal service.goim.gateway", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetUserService() != "service.goim.user" { - err := ServiceValidationError{ - field: "UserService", - reason: "value must equal service.goim.user", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetPushService() != "service.goim.push" { - err := ServiceValidationError{ - field: "PushService", - reason: "value must equal service.goim.push", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetStoreService() != "service.goim.store" { - err := ServiceValidationError{ - field: "StoreService", - reason: "value must equal service.goim.store", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetMsgService() != "service.goim.msg" { - err := ServiceValidationError{ - field: "MsgService", - reason: "value must equal service.goim.msg", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.Http != nil { - - if all { - switch v := interface{}(m.GetHttp()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Http", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Http", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServiceValidationError{ - field: "Http", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if m.Grpc != nil { - - if all { - switch v := interface{}(m.GetGrpc()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Grpc", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ServiceValidationError{ - field: "Grpc", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpc()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ServiceValidationError{ - field: "Grpc", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return ServiceMultiError(errors) - } - - return nil -} - -// ServiceMultiError is an error wrapping multiple validation errors returned -// by Service.ValidateAll() if the designated constraints aren't met. -type ServiceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ServiceMultiError) 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 ServiceMultiError) AllErrors() []error { return m } - -// ServiceValidationError is the validation error returned by Service.Validate -// if the designated constraints aren't met. -type ServiceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ServiceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ServiceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ServiceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ServiceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ServiceValidationError) ErrorName() string { return "ServiceValidationError" } - -// Error satisfies the builtin error interface -func (e ServiceValidationError) 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 %sService.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ServiceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ServiceValidationError{} - -// Validate checks the field values on Log 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 *Log) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Log 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 LogMultiError, or nil if none found. -func (m *Log) ValidateAll() error { - return m.validate(true) -} - -func (m *Log) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := Level_name[int32(m.GetLevel())]; !ok { - err := LogValidationError{ - field: "Level", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for EnableConsole - - if m.LogPath != nil { - // no validation rules for LogPath - } - - if len(errors) > 0 { - return LogMultiError(errors) - } - - return nil -} - -// LogMultiError is an error wrapping multiple validation errors returned by -// Log.ValidateAll() if the designated constraints aren't met. -type LogMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m LogMultiError) 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 LogMultiError) AllErrors() []error { return m } - -// LogValidationError is the validation error returned by Log.Validate if the -// designated constraints aren't met. -type LogValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e LogValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e LogValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e LogValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e LogValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e LogValidationError) ErrorName() string { return "LogValidationError" } - -// Error satisfies the builtin error interface -func (e LogValidationError) 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 %sLog.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = LogValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = LogValidationError{} - -// Validate checks the field values on Redis 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 *Redis) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Redis 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 RedisMultiError, or nil if none found. -func (m *Redis) ValidateAll() error { - return m.validate(true) -} - -func (m *Redis) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Addr - - // no validation rules for Password - - // no validation rules for MaxConns - - // no validation rules for MinIdleConns - - if d := m.GetDialTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = RedisValidationError{ - field: "DialTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(10*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 10000000*time.Nanosecond) - - if dur < gte || dur > lte { - err := RedisValidationError{ - field: "DialTimeout", - reason: "value must be inside range [10ms, 10s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetIdleTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = RedisValidationError{ - field: "IdleTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(10*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 10000000*time.Nanosecond) - - if dur < gte || dur > lte { - err := RedisValidationError{ - field: "IdleTimeout", - reason: "value must be inside range [10ms, 10s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return RedisMultiError(errors) - } - - return nil -} - -// RedisMultiError is an error wrapping multiple validation errors returned by -// Redis.ValidateAll() if the designated constraints aren't met. -type RedisMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RedisMultiError) 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 RedisMultiError) AllErrors() []error { return m } - -// RedisValidationError is the validation error returned by Redis.Validate if -// the designated constraints aren't met. -type RedisValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RedisValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RedisValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RedisValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RedisValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RedisValidationError) ErrorName() string { return "RedisValidationError" } - -// Error satisfies the builtin error interface -func (e RedisValidationError) 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 %sRedis.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RedisValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RedisValidationError{} - -// Validate checks the field values on MQ 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 *MQ) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MQ 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 MQMultiError, or nil if none found. -func (m *MQ) ValidateAll() error { - return m.validate(true) -} - -func (m *MQ) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for MaxRetry - - if len(errors) > 0 { - return MQMultiError(errors) - } - - return nil -} - -// MQMultiError is an error wrapping multiple validation errors returned by -// MQ.ValidateAll() if the designated constraints aren't met. -type MQMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MQMultiError) 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 MQMultiError) AllErrors() []error { return m } - -// MQValidationError is the validation error returned by MQ.Validate if the -// designated constraints aren't met. -type MQValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MQValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MQValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MQValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MQValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MQValidationError) ErrorName() string { return "MQValidationError" } - -// Error satisfies the builtin error interface -func (e MQValidationError) 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 %sMQ.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MQValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MQValidationError{} - -// Validate checks the field values on MySQL 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 *MySQL) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MySQL 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 MySQLMultiError, or nil if none found. -func (m *MySQL) ValidateAll() error { - return m.validate(true) -} - -func (m *MySQL) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Addr - - // no validation rules for User - - // no validation rules for Password - - // no validation rules for Db - - // no validation rules for MaxIdleConns - - // no validation rules for MaxOpenConns - - if d := m.GetIdleTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = MySQLValidationError{ - field: "IdleTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(10*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte || dur > lte { - err := MySQLValidationError{ - field: "IdleTimeout", - reason: "value must be inside range [1ms, 10s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetOpenTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = MySQLValidationError{ - field: "OpenTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(10*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte || dur > lte { - err := MySQLValidationError{ - field: "OpenTimeout", - reason: "value must be inside range [1ms, 10s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return MySQLMultiError(errors) - } - - return nil -} - -// MySQLMultiError is an error wrapping multiple validation errors returned by -// MySQL.ValidateAll() if the designated constraints aren't met. -type MySQLMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MySQLMultiError) 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 MySQLMultiError) AllErrors() []error { return m } - -// MySQLValidationError is the validation error returned by MySQL.Validate if -// the designated constraints aren't met. -type MySQLValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MySQLValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MySQLValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MySQLValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MySQLValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MySQLValidationError) ErrorName() string { return "MySQLValidationError" } - -// Error satisfies the builtin error interface -func (e MySQLValidationError) 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 %sMySQL.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MySQLValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MySQLValidationError{} diff --git a/api/config/v1/config.proto b/api/config/v1/config.proto deleted file mode 100644 index 0bd0be2..0000000 --- a/api/config/v1/config.proto +++ /dev/null @@ -1,91 +0,0 @@ -syntax = "proto3"; - -package api.config.v1; -option go_package = "api/config/v1;v1"; - -import "google/protobuf/duration.proto"; - -import "validate/validate.proto"; - -message Server { - string scheme = 1 [(validate.rules).string = {in: ["http", "grpc", "tcp"]}]; - int32 port = 2 [(validate.rules).int32 = {gt: 10000, lt: 60535}]; - // range:[10ms, 10s] - google.protobuf.Duration timeout = 3 [(validate.rules).duration = { - gte: {nanos: 10000000, seconds: 0}, - lte: {seconds: 10} - }]; -} - -message Service { - string name = 1 [(validate.rules).string.prefix= "service.goim"]; - string version = 2 [(validate.rules).string.min_len=1]; - optional Server http = 3; - optional Server grpc = 4; - Log log = 5; - map metadata = 6; - Redis redis = 7; - MQ mq = 8; - MySQL mysql = 9; - // services name - string gatewayService = 10 [(validate.rules).string.const= "service.goim.gateway"]; - string userService = 11 [(validate.rules).string.const= "service.goim.user"]; - string pushService = 12 [(validate.rules).string.const= "service.goim.push"]; - string storeService = 13 [(validate.rules).string.const= "service.goim.store"]; - string msgService = 14 [(validate.rules).string.const= "service.goim.msg"]; -} - -enum Level { - DEBUG = 0; - INFO = 1; - WARNING = 2; - ERROR = 3; - FATAL = 4; -} - -message Log { - optional string log_path = 1; - Level level = 2 [(validate.rules).enum.defined_only = true]; - bool enable_console = 3; -} - -message Redis { - string addr = 1; - string password = 2; - int32 max_conns = 3; - int32 min_idle_conns = 4; - // range: [10ms,10s] - google.protobuf.Duration dial_timeout = 5 [(validate.rules).duration = { - gte: {nanos: 10000000, seconds: 0}, - lte: {seconds: 10} - }]; - // range: [10ms,10s] - google.protobuf.Duration idle_timeout = 6 [(validate.rules).duration = { - gte: {nanos: 10000000, seconds: 0}, - lte: {seconds: 10} - }]; -} - -message MQ { - repeated string addr = 1; - int32 max_retry = 2; -} - -message MySQL { - string addr = 1; - string user = 2; - string password = 3; - string db = 4; - int32 max_idle_conns = 5; - int32 max_open_conns = 6; - // range: [10ms,10s] - google.protobuf.Duration idle_timeout = 7 [(validate.rules).duration = { - gte: {nanos: 1000000, seconds: 0}, - lte: {seconds: 10} - }]; - // range: [10ms,10s] - google.protobuf.Duration open_timeout = 8 [(validate.rules).duration = { - gte: {nanos: 1000000, seconds: 0}, - lte: {seconds: 10} - }]; -} \ No newline at end of file diff --git a/api/message/v1/message.pb.go b/api/message/v1/message.pb.go deleted file mode 100644 index 12599d4..0000000 --- a/api/message/v1/message.pb.go +++ /dev/null @@ -1,957 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.4 -// source: api/message/v1/message.proto - -package v1 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - response "github.com/go-goim/core/api/transport/response" - 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 MessageContentType int32 - -const ( - MessageContentType_UnknownContentType MessageContentType = 0 - MessageContentType_Text MessageContentType = 1 - MessageContentType_Image MessageContentType = 2 - MessageContentType_Voice MessageContentType = 3 -) - -// Enum value maps for MessageContentType. -var ( - MessageContentType_name = map[int32]string{ - 0: "UnknownContentType", - 1: "Text", - 2: "Image", - 3: "Voice", - } - MessageContentType_value = map[string]int32{ - "UnknownContentType": 0, - "Text": 1, - "Image": 2, - "Voice": 3, - } -) - -func (x MessageContentType) Enum() *MessageContentType { - p := new(MessageContentType) - *p = x - return p -} - -func (x MessageContentType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MessageContentType) Descriptor() protoreflect.EnumDescriptor { - return file_api_message_v1_message_proto_enumTypes[0].Descriptor() -} - -func (MessageContentType) Type() protoreflect.EnumType { - return &file_api_message_v1_message_proto_enumTypes[0] -} - -func (x MessageContentType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MessageContentType.Descriptor instead. -func (MessageContentType) EnumDescriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{0} -} - -type PushMessageType int32 - -const ( - PushMessageType_UnknownUserType PushMessageType = 0 - // user to user - PushMessageType_User PushMessageType = 1 - // user to group - PushMessageType_Group PushMessageType = 2 - // global broadcast - PushMessageType_Broadcast PushMessageType = 3 -) - -// Enum value maps for PushMessageType. -var ( - PushMessageType_name = map[int32]string{ - 0: "UnknownUserType", - 1: "User", - 2: "Group", - 3: "Broadcast", - } - PushMessageType_value = map[string]int32{ - "UnknownUserType": 0, - "User": 1, - "Group": 2, - "Broadcast": 3, - } -) - -func (x PushMessageType) Enum() *PushMessageType { - p := new(PushMessageType) - *p = x - return p -} - -func (x PushMessageType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PushMessageType) Descriptor() protoreflect.EnumDescriptor { - return file_api_message_v1_message_proto_enumTypes[1].Descriptor() -} - -func (PushMessageType) Type() protoreflect.EnumType { - return &file_api_message_v1_message_proto_enumTypes[1] -} - -func (x PushMessageType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PushMessageType.Descriptor instead. -func (PushMessageType) EnumDescriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{1} -} - -// SendMessageReq receive data from gateway -type SendMessageReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FromUser string `protobuf:"bytes,1,opt,name=from_user,json=fromUser,proto3" json:"from_user,omitempty"` - ToUser string `protobuf:"bytes,2,opt,name=to_user,json=toUser,proto3" json:"to_user,omitempty"` - ContentType MessageContentType `protobuf:"varint,3,opt,name=content_type,json=contentType,proto3,enum=api.message.v1.MessageContentType" json:"content_type,omitempty"` - Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *SendMessageReq) Reset() { - *x = SendMessageReq{} - if protoimpl.UnsafeEnabled { - mi := &file_api_message_v1_message_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SendMessageReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SendMessageReq) ProtoMessage() {} - -func (x *SendMessageReq) ProtoReflect() protoreflect.Message { - mi := &file_api_message_v1_message_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 SendMessageReq.ProtoReflect.Descriptor instead. -func (*SendMessageReq) Descriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{0} -} - -func (x *SendMessageReq) GetFromUser() string { - if x != nil { - return x.FromUser - } - return "" -} - -func (x *SendMessageReq) GetToUser() string { - if x != nil { - return x.ToUser - } - return "" -} - -func (x *SendMessageReq) GetContentType() MessageContentType { - if x != nil { - return x.ContentType - } - return MessageContentType_UnknownContentType -} - -func (x *SendMessageReq) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -// SendMessageResp is response body for sendMessage -type SendMessageResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - // MsgSeq is unique seq of a message - MsgSeq string `protobuf:"bytes,3,opt,name=msg_seq,json=msgSeq,proto3" json:"msg_seq,omitempty"` -} - -func (x *SendMessageResp) Reset() { - *x = SendMessageResp{} - if protoimpl.UnsafeEnabled { - mi := &file_api_message_v1_message_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SendMessageResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SendMessageResp) ProtoMessage() {} - -func (x *SendMessageResp) ProtoReflect() protoreflect.Message { - mi := &file_api_message_v1_message_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 SendMessageResp.ProtoReflect.Descriptor instead. -func (*SendMessageResp) Descriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{1} -} - -func (x *SendMessageResp) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *SendMessageResp) GetMsgSeq() string { - if x != nil { - return x.MsgSeq - } - return "" -} - -// MqMessage is message protocol when pub/sub msg to mq -type MqMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FromUser string `protobuf:"bytes,1,opt,name=from_user,json=fromUser,proto3" json:"from_user,omitempty"` - ToUser string `protobuf:"bytes,2,opt,name=to_user,json=toUser,proto3" json:"to_user,omitempty"` - PushMessageType PushMessageType `protobuf:"varint,3,opt,name=push_message_type,json=pushMessageType,proto3,enum=api.message.v1.PushMessageType" json:"push_message_type,omitempty"` - ContentType MessageContentType `protobuf:"varint,4,opt,name=content_type,json=contentType,proto3,enum=api.message.v1.MessageContentType" json:"content_type,omitempty"` - Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *MqMessage) Reset() { - *x = MqMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_api_message_v1_message_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MqMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MqMessage) ProtoMessage() {} - -func (x *MqMessage) ProtoReflect() protoreflect.Message { - mi := &file_api_message_v1_message_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 MqMessage.ProtoReflect.Descriptor instead. -func (*MqMessage) Descriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{2} -} - -func (x *MqMessage) GetFromUser() string { - if x != nil { - return x.FromUser - } - return "" -} - -func (x *MqMessage) GetToUser() string { - if x != nil { - return x.ToUser - } - return "" -} - -func (x *MqMessage) GetPushMessageType() PushMessageType { - if x != nil { - return x.PushMessageType - } - return PushMessageType_UnknownUserType -} - -func (x *MqMessage) GetContentType() MessageContentType { - if x != nil { - return x.ContentType - } - return MessageContentType_UnknownContentType -} - -func (x *MqMessage) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -// PushMessage use for push a message to persistence connection server -type PushMessageReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FromUser string `protobuf:"bytes,1,opt,name=from_user,json=fromUser,proto3" json:"from_user,omitempty"` - ToUser string `protobuf:"bytes,2,opt,name=to_user,json=toUser,proto3" json:"to_user,omitempty"` - AgentId string `protobuf:"bytes,3,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` - PushMessageType PushMessageType `protobuf:"varint,4,opt,name=push_message_type,json=pushMessageType,proto3,enum=api.message.v1.PushMessageType" json:"push_message_type,omitempty"` - ContentType MessageContentType `protobuf:"varint,5,opt,name=content_type,json=contentType,proto3,enum=api.message.v1.MessageContentType" json:"content_type,omitempty"` - Content string `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"` - MsgSeq string `protobuf:"bytes,7,opt,name=msg_seq,json=msgSeq,proto3" json:"msg_seq,omitempty"` -} - -func (x *PushMessageReq) Reset() { - *x = PushMessageReq{} - if protoimpl.UnsafeEnabled { - mi := &file_api_message_v1_message_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PushMessageReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PushMessageReq) ProtoMessage() {} - -func (x *PushMessageReq) ProtoReflect() protoreflect.Message { - mi := &file_api_message_v1_message_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 PushMessageReq.ProtoReflect.Descriptor instead. -func (*PushMessageReq) Descriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{3} -} - -func (x *PushMessageReq) GetFromUser() string { - if x != nil { - return x.FromUser - } - return "" -} - -func (x *PushMessageReq) GetToUser() string { - if x != nil { - return x.ToUser - } - return "" -} - -func (x *PushMessageReq) GetAgentId() string { - if x != nil { - return x.AgentId - } - return "" -} - -func (x *PushMessageReq) GetPushMessageType() PushMessageType { - if x != nil { - return x.PushMessageType - } - return PushMessageType_UnknownUserType -} - -func (x *PushMessageReq) GetContentType() MessageContentType { - if x != nil { - return x.ContentType - } - return MessageContentType_UnknownContentType -} - -func (x *PushMessageReq) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *PushMessageReq) GetMsgSeq() string { - if x != nil { - return x.MsgSeq - } - return "" -} - -// BriefMessage is message with basic information -type BriefMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FromUser string `protobuf:"bytes,1,opt,name=from_user,json=fromUser,proto3" json:"from_user,omitempty"` - ToUser string `protobuf:"bytes,2,opt,name=to_user,json=toUser,proto3" json:"to_user,omitempty"` - ContentType MessageContentType `protobuf:"varint,3,opt,name=content_type,json=contentType,proto3,enum=api.message.v1.MessageContentType" json:"content_type,omitempty"` - Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` - MsgSeq string `protobuf:"bytes,5,opt,name=msg_seq,json=msgSeq,proto3" json:"msg_seq,omitempty"` -} - -func (x *BriefMessage) Reset() { - *x = BriefMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_api_message_v1_message_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BriefMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BriefMessage) ProtoMessage() {} - -func (x *BriefMessage) ProtoReflect() protoreflect.Message { - mi := &file_api_message_v1_message_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 BriefMessage.ProtoReflect.Descriptor instead. -func (*BriefMessage) Descriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{4} -} - -func (x *BriefMessage) GetFromUser() string { - if x != nil { - return x.FromUser - } - return "" -} - -func (x *BriefMessage) GetToUser() string { - if x != nil { - return x.ToUser - } - return "" -} - -func (x *BriefMessage) GetContentType() MessageContentType { - if x != nil { - return x.ContentType - } - return MessageContentType_UnknownContentType -} - -func (x *BriefMessage) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *BriefMessage) GetMsgSeq() string { - if x != nil { - return x.MsgSeq - } - return "" -} - -type QueryOfflineMessageReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - LastMsgSeq string `protobuf:"bytes,2,opt,name=last_msg_seq,json=lastMsgSeq,proto3" json:"last_msg_seq,omitempty"` - OnlyCount bool `protobuf:"varint,3,opt,name=onlyCount,proto3" json:"onlyCount,omitempty"` - Page int32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"` - PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` -} - -func (x *QueryOfflineMessageReq) Reset() { - *x = QueryOfflineMessageReq{} - if protoimpl.UnsafeEnabled { - mi := &file_api_message_v1_message_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryOfflineMessageReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryOfflineMessageReq) ProtoMessage() {} - -func (x *QueryOfflineMessageReq) ProtoReflect() protoreflect.Message { - mi := &file_api_message_v1_message_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 QueryOfflineMessageReq.ProtoReflect.Descriptor instead. -func (*QueryOfflineMessageReq) Descriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{5} -} - -func (x *QueryOfflineMessageReq) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -func (x *QueryOfflineMessageReq) GetLastMsgSeq() string { - if x != nil { - return x.LastMsgSeq - } - return "" -} - -func (x *QueryOfflineMessageReq) GetOnlyCount() bool { - if x != nil { - return x.OnlyCount - } - return false -} - -func (x *QueryOfflineMessageReq) GetPage() int32 { - if x != nil { - return x.Page - } - return 0 -} - -func (x *QueryOfflineMessageReq) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -type QueryOfflineMessageResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - Messages []*BriefMessage `protobuf:"bytes,3,rep,name=messages,proto3" json:"messages,omitempty"` -} - -func (x *QueryOfflineMessageResp) Reset() { - *x = QueryOfflineMessageResp{} - if protoimpl.UnsafeEnabled { - mi := &file_api_message_v1_message_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryOfflineMessageResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryOfflineMessageResp) ProtoMessage() {} - -func (x *QueryOfflineMessageResp) ProtoReflect() protoreflect.Message { - mi := &file_api_message_v1_message_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 QueryOfflineMessageResp.ProtoReflect.Descriptor instead. -func (*QueryOfflineMessageResp) Descriptor() ([]byte, []int) { - return file_api_message_v1_message_proto_rawDescGZIP(), []int{6} -} - -func (x *QueryOfflineMessageResp) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *QueryOfflineMessageResp) GetTotal() int32 { - if x != nil { - return x.Total - } - return 0 -} - -func (x *QueryOfflineMessageResp) GetMessages() []*BriefMessage { - if x != nil { - return x.Messages - } - return nil -} - -var File_api_message_v1_message_proto protoreflect.FileDescriptor - -var file_api_message_v1_message_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, - 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, - 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 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, 0x1a, 0x21, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, - 0x72, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcf, 0x01, 0x0a, 0x0e, 0x53, - 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, - 0x09, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x14, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x6f, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x14, 0x52, 0x06, 0x74, - 0x6f, 0x55, 0x73, 0x65, 0x72, 0x12, 0x4f, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, - 0x18, 0x80, 0x08, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x6c, 0x0a, 0x0f, - 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x40, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, - 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x5f, 0x73, 0x65, 0x71, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x6d, 0x73, 0x67, 0x53, 0x65, 0x71, 0x22, 0xef, 0x01, 0x0a, 0x09, 0x4d, - 0x71, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x6f, 0x6d, - 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x6f, - 0x6d, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x6f, 0x5f, 0x75, 0x73, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x12, 0x4b, - 0x0a, 0x11, 0x70, 0x75, 0x73, 0x68, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0f, 0x70, 0x75, 0x73, 0x68, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x0c, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xa8, 0x02, 0x0a, - 0x0e, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, - 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, - 0x74, 0x6f, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, - 0x6f, 0x55, 0x73, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, - 0x12, 0x4b, 0x0a, 0x11, 0x70, 0x75, 0x73, 0x68, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x73, - 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0f, 0x70, 0x75, - 0x73, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, - 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x17, - 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x5f, 0x73, 0x65, 0x71, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6d, 0x73, 0x67, 0x53, 0x65, 0x71, 0x22, 0xbe, 0x01, 0x0a, 0x0c, 0x42, 0x72, 0x69, 0x65, - 0x66, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x6f, 0x6d, - 0x5f, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x6f, - 0x6d, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x6f, 0x5f, 0x75, 0x73, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x12, 0x45, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, - 0x17, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x5f, 0x73, 0x65, 0x71, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x6d, 0x73, 0x67, 0x53, 0x65, 0x71, 0x22, 0xbf, 0x01, 0x0a, 0x16, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x14, 0x52, 0x06, 0x75, - 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x73, - 0x67, 0x5f, 0x73, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x72, 0x02, 0x10, 0x0a, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x71, - 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x6e, 0x6c, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x6f, 0x6e, 0x6c, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, - 0x67, 0x65, 0x12, 0x26, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x05, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x1a, 0x04, 0x18, 0x64, 0x28, 0x01, - 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x17, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, - 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x38, - 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x42, 0x72, 0x69, 0x65, 0x66, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2a, 0x4c, 0x0a, 0x12, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, - 0x0a, 0x12, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x10, 0x01, - 0x12, 0x09, 0x0a, 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x56, - 0x6f, 0x69, 0x63, 0x65, 0x10, 0x03, 0x2a, 0x4a, 0x0a, 0x0f, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x55, 0x6e, 0x6b, - 0x6e, 0x6f, 0x77, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x08, - 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, - 0x10, 0x03, 0x32, 0xac, 0x01, 0x0a, 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x4c, 0x0a, 0x09, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, - 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, - 0x1a, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x32, 0x63, 0x0a, 0x0c, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x72, 0x12, 0x53, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, - 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, - 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x78, 0x0a, 0x0e, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, - 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x66, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x26, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4f, 0x66, - 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x42, 0x13, 0x5a, 0x11, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, - 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_message_v1_message_proto_rawDescOnce sync.Once - file_api_message_v1_message_proto_rawDescData = file_api_message_v1_message_proto_rawDesc -) - -func file_api_message_v1_message_proto_rawDescGZIP() []byte { - file_api_message_v1_message_proto_rawDescOnce.Do(func() { - file_api_message_v1_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_message_v1_message_proto_rawDescData) - }) - return file_api_message_v1_message_proto_rawDescData -} - -var file_api_message_v1_message_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_message_v1_message_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_api_message_v1_message_proto_goTypes = []interface{}{ - (MessageContentType)(0), // 0: api.message.v1.MessageContentType - (PushMessageType)(0), // 1: api.message.v1.PushMessageType - (*SendMessageReq)(nil), // 2: api.message.v1.SendMessageReq - (*SendMessageResp)(nil), // 3: api.message.v1.SendMessageResp - (*MqMessage)(nil), // 4: api.message.v1.MqMessage - (*PushMessageReq)(nil), // 5: api.message.v1.PushMessageReq - (*BriefMessage)(nil), // 6: api.message.v1.BriefMessage - (*QueryOfflineMessageReq)(nil), // 7: api.message.v1.QueryOfflineMessageReq - (*QueryOfflineMessageResp)(nil), // 8: api.message.v1.QueryOfflineMessageResp - (*response.BaseResponse)(nil), // 9: api.transport.response.BaseResponse -} -var file_api_message_v1_message_proto_depIdxs = []int32{ - 0, // 0: api.message.v1.SendMessageReq.content_type:type_name -> api.message.v1.MessageContentType - 9, // 1: api.message.v1.SendMessageResp.response:type_name -> api.transport.response.BaseResponse - 1, // 2: api.message.v1.MqMessage.push_message_type:type_name -> api.message.v1.PushMessageType - 0, // 3: api.message.v1.MqMessage.content_type:type_name -> api.message.v1.MessageContentType - 1, // 4: api.message.v1.PushMessageReq.push_message_type:type_name -> api.message.v1.PushMessageType - 0, // 5: api.message.v1.PushMessageReq.content_type:type_name -> api.message.v1.MessageContentType - 0, // 6: api.message.v1.BriefMessage.content_type:type_name -> api.message.v1.MessageContentType - 9, // 7: api.message.v1.QueryOfflineMessageResp.response:type_name -> api.transport.response.BaseResponse - 6, // 8: api.message.v1.QueryOfflineMessageResp.messages:type_name -> api.message.v1.BriefMessage - 2, // 9: api.message.v1.SendMessager.SendMessage:input_type -> api.message.v1.SendMessageReq - 2, // 10: api.message.v1.SendMessager.Broadcast:input_type -> api.message.v1.SendMessageReq - 5, // 11: api.message.v1.PushMessager.PushMessage:input_type -> api.message.v1.PushMessageReq - 7, // 12: api.message.v1.OfflineMessage.QueryOfflineMessage:input_type -> api.message.v1.QueryOfflineMessageReq - 3, // 13: api.message.v1.SendMessager.SendMessage:output_type -> api.message.v1.SendMessageResp - 3, // 14: api.message.v1.SendMessager.Broadcast:output_type -> api.message.v1.SendMessageResp - 9, // 15: api.message.v1.PushMessager.PushMessage:output_type -> api.transport.response.BaseResponse - 8, // 16: api.message.v1.OfflineMessage.QueryOfflineMessage:output_type -> api.message.v1.QueryOfflineMessageResp - 13, // [13:17] is the sub-list for method output_type - 9, // [9:13] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_api_message_v1_message_proto_init() } -func file_api_message_v1_message_proto_init() { - if File_api_message_v1_message_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_message_v1_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendMessageReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_message_v1_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendMessageResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_message_v1_message_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MqMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_message_v1_message_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PushMessageReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_message_v1_message_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BriefMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_message_v1_message_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryOfflineMessageReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_message_v1_message_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryOfflineMessageResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_message_v1_message_proto_rawDesc, - NumEnums: 2, - NumMessages: 7, - NumExtensions: 0, - NumServices: 3, - }, - GoTypes: file_api_message_v1_message_proto_goTypes, - DependencyIndexes: file_api_message_v1_message_proto_depIdxs, - EnumInfos: file_api_message_v1_message_proto_enumTypes, - MessageInfos: file_api_message_v1_message_proto_msgTypes, - }.Build() - File_api_message_v1_message_proto = out.File - file_api_message_v1_message_proto_rawDesc = nil - file_api_message_v1_message_proto_goTypes = nil - file_api_message_v1_message_proto_depIdxs = nil -} diff --git a/api/message/v1/message.pb.validate.go b/api/message/v1/message.pb.validate.go deleted file mode 100644 index 45b616f..0000000 --- a/api/message/v1/message.pb.validate.go +++ /dev/null @@ -1,949 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: api/message/v1/message.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 SendMessageReq 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 *SendMessageReq) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SendMessageReq 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 SendMessageReqMultiError, -// or nil if none found. -func (m *SendMessageReq) ValidateAll() error { - return m.validate(true) -} - -func (m *SendMessageReq) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetFromUser()) < 20 { - err := SendMessageReqValidationError{ - field: "FromUser", - reason: "value length must be at least 20 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetToUser()) < 20 { - err := SendMessageReqValidationError{ - field: "ToUser", - reason: "value length must be at least 20 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := MessageContentType_name[int32(m.GetContentType())]; !ok { - err := SendMessageReqValidationError{ - field: "ContentType", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if l := utf8.RuneCountInString(m.GetContent()); l < 1 || l > 1024 { - err := SendMessageReqValidationError{ - field: "Content", - reason: "value length must be between 1 and 1024 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return SendMessageReqMultiError(errors) - } - - return nil -} - -// SendMessageReqMultiError is an error wrapping multiple validation errors -// returned by SendMessageReq.ValidateAll() if the designated constraints -// aren't met. -type SendMessageReqMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SendMessageReqMultiError) 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 SendMessageReqMultiError) AllErrors() []error { return m } - -// SendMessageReqValidationError is the validation error returned by -// SendMessageReq.Validate if the designated constraints aren't met. -type SendMessageReqValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SendMessageReqValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SendMessageReqValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SendMessageReqValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SendMessageReqValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SendMessageReqValidationError) ErrorName() string { return "SendMessageReqValidationError" } - -// Error satisfies the builtin error interface -func (e SendMessageReqValidationError) 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 %sSendMessageReq.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SendMessageReqValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SendMessageReqValidationError{} - -// Validate checks the field values on SendMessageResp 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 *SendMessageResp) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SendMessageResp 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 -// SendMessageRespMultiError, or nil if none found. -func (m *SendMessageResp) ValidateAll() error { - return m.validate(true) -} - -func (m *SendMessageResp) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SendMessageRespValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SendMessageRespValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SendMessageRespValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for MsgSeq - - if len(errors) > 0 { - return SendMessageRespMultiError(errors) - } - - return nil -} - -// SendMessageRespMultiError is an error wrapping multiple validation errors -// returned by SendMessageResp.ValidateAll() if the designated constraints -// aren't met. -type SendMessageRespMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SendMessageRespMultiError) 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 SendMessageRespMultiError) AllErrors() []error { return m } - -// SendMessageRespValidationError is the validation error returned by -// SendMessageResp.Validate if the designated constraints aren't met. -type SendMessageRespValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SendMessageRespValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SendMessageRespValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SendMessageRespValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SendMessageRespValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SendMessageRespValidationError) ErrorName() string { return "SendMessageRespValidationError" } - -// Error satisfies the builtin error interface -func (e SendMessageRespValidationError) 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 %sSendMessageResp.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SendMessageRespValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SendMessageRespValidationError{} - -// Validate checks the field values on MqMessage 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 *MqMessage) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MqMessage 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 MqMessageMultiError, or nil -// if none found. -func (m *MqMessage) ValidateAll() error { - return m.validate(true) -} - -func (m *MqMessage) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for FromUser - - // no validation rules for ToUser - - // no validation rules for PushMessageType - - // no validation rules for ContentType - - // no validation rules for Content - - if len(errors) > 0 { - return MqMessageMultiError(errors) - } - - return nil -} - -// MqMessageMultiError is an error wrapping multiple validation errors returned -// by MqMessage.ValidateAll() if the designated constraints aren't met. -type MqMessageMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MqMessageMultiError) 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 MqMessageMultiError) AllErrors() []error { return m } - -// MqMessageValidationError is the validation error returned by -// MqMessage.Validate if the designated constraints aren't met. -type MqMessageValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MqMessageValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MqMessageValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MqMessageValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MqMessageValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MqMessageValidationError) ErrorName() string { return "MqMessageValidationError" } - -// Error satisfies the builtin error interface -func (e MqMessageValidationError) 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 %sMqMessage.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MqMessageValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MqMessageValidationError{} - -// Validate checks the field values on PushMessageReq 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 *PushMessageReq) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PushMessageReq 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 PushMessageReqMultiError, -// or nil if none found. -func (m *PushMessageReq) ValidateAll() error { - return m.validate(true) -} - -func (m *PushMessageReq) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for FromUser - - // no validation rules for ToUser - - // no validation rules for AgentId - - // no validation rules for PushMessageType - - // no validation rules for ContentType - - // no validation rules for Content - - // no validation rules for MsgSeq - - if len(errors) > 0 { - return PushMessageReqMultiError(errors) - } - - return nil -} - -// PushMessageReqMultiError is an error wrapping multiple validation errors -// returned by PushMessageReq.ValidateAll() if the designated constraints -// aren't met. -type PushMessageReqMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PushMessageReqMultiError) 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 PushMessageReqMultiError) AllErrors() []error { return m } - -// PushMessageReqValidationError is the validation error returned by -// PushMessageReq.Validate if the designated constraints aren't met. -type PushMessageReqValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PushMessageReqValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PushMessageReqValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PushMessageReqValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PushMessageReqValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PushMessageReqValidationError) ErrorName() string { return "PushMessageReqValidationError" } - -// Error satisfies the builtin error interface -func (e PushMessageReqValidationError) 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 %sPushMessageReq.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PushMessageReqValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PushMessageReqValidationError{} - -// Validate checks the field values on BriefMessage 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 *BriefMessage) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BriefMessage 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 BriefMessageMultiError, or -// nil if none found. -func (m *BriefMessage) ValidateAll() error { - return m.validate(true) -} - -func (m *BriefMessage) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for FromUser - - // no validation rules for ToUser - - // no validation rules for ContentType - - // no validation rules for Content - - // no validation rules for MsgSeq - - if len(errors) > 0 { - return BriefMessageMultiError(errors) - } - - return nil -} - -// BriefMessageMultiError is an error wrapping multiple validation errors -// returned by BriefMessage.ValidateAll() if the designated constraints aren't met. -type BriefMessageMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BriefMessageMultiError) 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 BriefMessageMultiError) AllErrors() []error { return m } - -// BriefMessageValidationError is the validation error returned by -// BriefMessage.Validate if the designated constraints aren't met. -type BriefMessageValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BriefMessageValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BriefMessageValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BriefMessageValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BriefMessageValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BriefMessageValidationError) ErrorName() string { return "BriefMessageValidationError" } - -// Error satisfies the builtin error interface -func (e BriefMessageValidationError) 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 %sBriefMessage.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BriefMessageValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BriefMessageValidationError{} - -// Validate checks the field values on QueryOfflineMessageReq 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 *QueryOfflineMessageReq) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryOfflineMessageReq 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 -// QueryOfflineMessageReqMultiError, or nil if none found. -func (m *QueryOfflineMessageReq) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryOfflineMessageReq) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetUserId()) < 20 { - err := QueryOfflineMessageReqValidationError{ - field: "UserId", - reason: "value length must be at least 20 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if utf8.RuneCountInString(m.GetLastMsgSeq()) < 10 { - err := QueryOfflineMessageReqValidationError{ - field: "LastMsgSeq", - reason: "value length must be at least 10 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for OnlyCount - - // no validation rules for Page - - if val := m.GetPageSize(); val < 1 || val > 100 { - err := QueryOfflineMessageReqValidationError{ - field: "PageSize", - reason: "value must be inside range [1, 100]", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return QueryOfflineMessageReqMultiError(errors) - } - - return nil -} - -// QueryOfflineMessageReqMultiError is an error wrapping multiple validation -// errors returned by QueryOfflineMessageReq.ValidateAll() if the designated -// constraints aren't met. -type QueryOfflineMessageReqMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryOfflineMessageReqMultiError) 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 QueryOfflineMessageReqMultiError) AllErrors() []error { return m } - -// QueryOfflineMessageReqValidationError is the validation error returned by -// QueryOfflineMessageReq.Validate if the designated constraints aren't met. -type QueryOfflineMessageReqValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryOfflineMessageReqValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryOfflineMessageReqValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryOfflineMessageReqValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryOfflineMessageReqValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryOfflineMessageReqValidationError) ErrorName() string { - return "QueryOfflineMessageReqValidationError" -} - -// Error satisfies the builtin error interface -func (e QueryOfflineMessageReqValidationError) 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 %sQueryOfflineMessageReq.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryOfflineMessageReqValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryOfflineMessageReqValidationError{} - -// Validate checks the field values on QueryOfflineMessageResp 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 *QueryOfflineMessageResp) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryOfflineMessageResp 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 -// QueryOfflineMessageRespMultiError, or nil if none found. -func (m *QueryOfflineMessageResp) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryOfflineMessageResp) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QueryOfflineMessageRespValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QueryOfflineMessageRespValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return QueryOfflineMessageRespValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Total - - for idx, item := range m.GetMessages() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QueryOfflineMessageRespValidationError{ - field: fmt.Sprintf("Messages[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QueryOfflineMessageRespValidationError{ - field: fmt.Sprintf("Messages[%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 QueryOfflineMessageRespValidationError{ - field: fmt.Sprintf("Messages[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return QueryOfflineMessageRespMultiError(errors) - } - - return nil -} - -// QueryOfflineMessageRespMultiError is an error wrapping multiple validation -// errors returned by QueryOfflineMessageResp.ValidateAll() if the designated -// constraints aren't met. -type QueryOfflineMessageRespMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryOfflineMessageRespMultiError) 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 QueryOfflineMessageRespMultiError) AllErrors() []error { return m } - -// QueryOfflineMessageRespValidationError is the validation error returned by -// QueryOfflineMessageResp.Validate if the designated constraints aren't met. -type QueryOfflineMessageRespValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryOfflineMessageRespValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryOfflineMessageRespValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryOfflineMessageRespValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryOfflineMessageRespValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryOfflineMessageRespValidationError) ErrorName() string { - return "QueryOfflineMessageRespValidationError" -} - -// Error satisfies the builtin error interface -func (e QueryOfflineMessageRespValidationError) 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 %sQueryOfflineMessageResp.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryOfflineMessageRespValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryOfflineMessageRespValidationError{} diff --git a/api/message/v1/message.proto b/api/message/v1/message.proto deleted file mode 100644 index 7e0d6ce..0000000 --- a/api/message/v1/message.proto +++ /dev/null @@ -1,99 +0,0 @@ -syntax = "proto3"; - -package api.message.v1; -option go_package = "api/message/v1;v1"; - -import "validate/validate.proto"; - -import "transport/response/response.proto"; - -enum MessageContentType { - UnknownContentType = 0; - Text = 1; - Image = 2; - Voice = 3; -} - -// SendMessageReq receive data from gateway -message SendMessageReq { - string from_user = 1 [(validate.rules).string.min_len = 20]; - string to_user = 2 [(validate.rules).string.min_len = 20]; - MessageContentType content_type = 3 [(validate.rules).enum.defined_only = true]; - string content = 4 [(validate.rules).string = {min_len: 1, max_len: 1024}]; -} - -// SendMessageResp is response body for sendMessage -message SendMessageResp { - transport.response.BaseResponse response = 1; - // MsgSeq is unique seq of a message - string msg_seq = 3; -} - -// SendMessager provide send message service -service SendMessager { - // SendMessage send message to one or multi users/channels - rpc SendMessage(SendMessageReq) returns (SendMessageResp); - // Broadcast send message to all online user - rpc Broadcast(SendMessageReq) returns (SendMessageResp); -} - -enum PushMessageType { - UnknownUserType = 0; - // user to user - User = 1; - // user to group - Group = 2; - // global broadcast - Broadcast = 3; -} - -// MqMessage is message protocol when pub/sub msg to mq -message MqMessage { - string from_user = 1; - string to_user = 2; - PushMessageType push_message_type = 3; - MessageContentType content_type = 4; - string content = 5; -} - -// PushMessage use for push a message to persistence connection server -message PushMessageReq { - string from_user = 1; - string to_user = 2; - string agent_id = 3; - PushMessageType push_message_type = 4; - MessageContentType content_type = 5; - string content = 6; - string msg_seq = 7; -} - -service PushMessager { - rpc PushMessage(PushMessageReq) returns (transport.response.BaseResponse); -} - -// BriefMessage is message with basic information -message BriefMessage { - string from_user = 1; - string to_user = 2; - MessageContentType content_type = 3; - string content = 4; - string msg_seq = 5; -} - -message QueryOfflineMessageReq { - string user_id = 1 [(validate.rules).string.min_len = 20]; - string last_msg_seq = 2 [(validate.rules).string.min_len = 10]; - bool onlyCount = 3; - int32 page = 4; - int32 page_size = 5 [(validate.rules).int32 = {gte: 1, lte: 100}]; -} - -message QueryOfflineMessageResp { - transport.response.BaseResponse response = 1; - int32 total = 2; - repeated BriefMessage messages = 3; -} - -service OfflineMessage { - rpc QueryOfflineMessage(QueryOfflineMessageReq) returns (QueryOfflineMessageResp); -} diff --git a/api/message/v1/message_grpc.pb.go b/api/message/v1/message_grpc.pb.go deleted file mode 100644 index cacf354..0000000 --- a/api/message/v1/message_grpc.pb.go +++ /dev/null @@ -1,314 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -package v1 - -import ( - context "context" - response "github.com/go-goim/core/api/transport/response" - 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 - -// SendMessagerClient is the client API for SendMessager 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 SendMessagerClient interface { - // SendMessage send message to one or multi users/channels - SendMessage(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) - // Broadcast send message to all online user - Broadcast(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) -} - -type sendMessagerClient struct { - cc grpc.ClientConnInterface -} - -func NewSendMessagerClient(cc grpc.ClientConnInterface) SendMessagerClient { - return &sendMessagerClient{cc} -} - -func (c *sendMessagerClient) SendMessage(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) { - out := new(SendMessageResp) - err := c.cc.Invoke(ctx, "/api.message.v1.SendMessager/SendMessage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sendMessagerClient) Broadcast(ctx context.Context, in *SendMessageReq, opts ...grpc.CallOption) (*SendMessageResp, error) { - out := new(SendMessageResp) - err := c.cc.Invoke(ctx, "/api.message.v1.SendMessager/Broadcast", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SendMessagerServer is the server API for SendMessager service. -// All implementations must embed UnimplementedSendMessagerServer -// for forward compatibility -type SendMessagerServer interface { - // SendMessage send message to one or multi users/channels - SendMessage(context.Context, *SendMessageReq) (*SendMessageResp, error) - // Broadcast send message to all online user - Broadcast(context.Context, *SendMessageReq) (*SendMessageResp, error) - mustEmbedUnimplementedSendMessagerServer() -} - -// UnimplementedSendMessagerServer must be embedded to have forward compatible implementations. -type UnimplementedSendMessagerServer struct { -} - -func (UnimplementedSendMessagerServer) SendMessage(context.Context, *SendMessageReq) (*SendMessageResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented") -} -func (UnimplementedSendMessagerServer) Broadcast(context.Context, *SendMessageReq) (*SendMessageResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method Broadcast not implemented") -} -func (UnimplementedSendMessagerServer) mustEmbedUnimplementedSendMessagerServer() {} - -// UnsafeSendMessagerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to SendMessagerServer will -// result in compilation errors. -type UnsafeSendMessagerServer interface { - mustEmbedUnimplementedSendMessagerServer() -} - -func RegisterSendMessagerServer(s grpc.ServiceRegistrar, srv SendMessagerServer) { - s.RegisterService(&SendMessager_ServiceDesc, srv) -} - -func _SendMessager_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SendMessagerServer).SendMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.message.v1.SendMessager/SendMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SendMessagerServer).SendMessage(ctx, req.(*SendMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _SendMessager_Broadcast_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SendMessagerServer).Broadcast(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.message.v1.SendMessager/Broadcast", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SendMessagerServer).Broadcast(ctx, req.(*SendMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -// SendMessager_ServiceDesc is the grpc.ServiceDesc for SendMessager service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var SendMessager_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "api.message.v1.SendMessager", - HandlerType: (*SendMessagerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SendMessage", - Handler: _SendMessager_SendMessage_Handler, - }, - { - MethodName: "Broadcast", - Handler: _SendMessager_Broadcast_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/message/v1/message.proto", -} - -// PushMessagerClient is the client API for PushMessager 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 PushMessagerClient interface { - PushMessage(ctx context.Context, in *PushMessageReq, opts ...grpc.CallOption) (*response.BaseResponse, error) -} - -type pushMessagerClient struct { - cc grpc.ClientConnInterface -} - -func NewPushMessagerClient(cc grpc.ClientConnInterface) PushMessagerClient { - return &pushMessagerClient{cc} -} - -func (c *pushMessagerClient) PushMessage(ctx context.Context, in *PushMessageReq, opts ...grpc.CallOption) (*response.BaseResponse, error) { - out := new(response.BaseResponse) - err := c.cc.Invoke(ctx, "/api.message.v1.PushMessager/PushMessage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PushMessagerServer is the server API for PushMessager service. -// All implementations must embed UnimplementedPushMessagerServer -// for forward compatibility -type PushMessagerServer interface { - PushMessage(context.Context, *PushMessageReq) (*response.BaseResponse, error) - mustEmbedUnimplementedPushMessagerServer() -} - -// UnimplementedPushMessagerServer must be embedded to have forward compatible implementations. -type UnimplementedPushMessagerServer struct { -} - -func (UnimplementedPushMessagerServer) PushMessage(context.Context, *PushMessageReq) (*response.BaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PushMessage not implemented") -} -func (UnimplementedPushMessagerServer) mustEmbedUnimplementedPushMessagerServer() {} - -// UnsafePushMessagerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PushMessagerServer will -// result in compilation errors. -type UnsafePushMessagerServer interface { - mustEmbedUnimplementedPushMessagerServer() -} - -func RegisterPushMessagerServer(s grpc.ServiceRegistrar, srv PushMessagerServer) { - s.RegisterService(&PushMessager_ServiceDesc, srv) -} - -func _PushMessager_PushMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PushMessagerServer).PushMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.message.v1.PushMessager/PushMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PushMessagerServer).PushMessage(ctx, req.(*PushMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -// PushMessager_ServiceDesc is the grpc.ServiceDesc for PushMessager service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var PushMessager_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "api.message.v1.PushMessager", - HandlerType: (*PushMessagerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "PushMessage", - Handler: _PushMessager_PushMessage_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/message/v1/message.proto", -} - -// OfflineMessageClient is the client API for OfflineMessage 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 OfflineMessageClient interface { - QueryOfflineMessage(ctx context.Context, in *QueryOfflineMessageReq, opts ...grpc.CallOption) (*QueryOfflineMessageResp, error) -} - -type offlineMessageClient struct { - cc grpc.ClientConnInterface -} - -func NewOfflineMessageClient(cc grpc.ClientConnInterface) OfflineMessageClient { - return &offlineMessageClient{cc} -} - -func (c *offlineMessageClient) QueryOfflineMessage(ctx context.Context, in *QueryOfflineMessageReq, opts ...grpc.CallOption) (*QueryOfflineMessageResp, error) { - out := new(QueryOfflineMessageResp) - err := c.cc.Invoke(ctx, "/api.message.v1.OfflineMessage/QueryOfflineMessage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// OfflineMessageServer is the server API for OfflineMessage service. -// All implementations must embed UnimplementedOfflineMessageServer -// for forward compatibility -type OfflineMessageServer interface { - QueryOfflineMessage(context.Context, *QueryOfflineMessageReq) (*QueryOfflineMessageResp, error) - mustEmbedUnimplementedOfflineMessageServer() -} - -// UnimplementedOfflineMessageServer must be embedded to have forward compatible implementations. -type UnimplementedOfflineMessageServer struct { -} - -func (UnimplementedOfflineMessageServer) QueryOfflineMessage(context.Context, *QueryOfflineMessageReq) (*QueryOfflineMessageResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryOfflineMessage not implemented") -} -func (UnimplementedOfflineMessageServer) mustEmbedUnimplementedOfflineMessageServer() {} - -// UnsafeOfflineMessageServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to OfflineMessageServer will -// result in compilation errors. -type UnsafeOfflineMessageServer interface { - mustEmbedUnimplementedOfflineMessageServer() -} - -func RegisterOfflineMessageServer(s grpc.ServiceRegistrar, srv OfflineMessageServer) { - s.RegisterService(&OfflineMessage_ServiceDesc, srv) -} - -func _OfflineMessage_QueryOfflineMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOfflineMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OfflineMessageServer).QueryOfflineMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.message.v1.OfflineMessage/QueryOfflineMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OfflineMessageServer).QueryOfflineMessage(ctx, req.(*QueryOfflineMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -// OfflineMessage_ServiceDesc is the grpc.ServiceDesc for OfflineMessage service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var OfflineMessage_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "api.message.v1.OfflineMessage", - HandlerType: (*OfflineMessageServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "QueryOfflineMessage", - Handler: _OfflineMessage_QueryOfflineMessage_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/message/v1/message.proto", -} diff --git a/api/transport/response/response.ext.go b/api/transport/response/response.ext.go deleted file mode 100644 index e7ef442..0000000 --- a/api/transport/response/response.ext.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code Written Manually - -package response - -import ( - "fmt" -) - -/* - * Define BaseResponse - */ - -var _ error = &BaseResponse{} - -func NewBaseResponse(code Code) *BaseResponse { - return &BaseResponse{ - Code: code, - Reason: code.String(), - } -} - -func NewBaseResponseWithMessage(code Code, msg string) *BaseResponse { - return &BaseResponse{ - Code: code, - Reason: code.String(), - Message: msg, - } -} - -func NewBaseResponseWithError(err error) *BaseResponse { - return &BaseResponse{ - Code: Code_InternalError, - Reason: Code_InternalError.String(), - Message: err.Error(), - } -} - -func (x *BaseResponse) Error() string { - return fmt.Sprintf("Code: %d, Reason: %s, Message: %s", x.Code, x.Reason, x.Message) -} - -func (x *BaseResponse) Success() bool { - return x.Code == Code_OK -} - -func (x *BaseResponse) SetMessage(msg string) *BaseResponse { - x.Message = msg - return x -} - -/* - * Code - */ - -func (x Code) BaseResponse() *BaseResponse { - return NewBaseResponse(x) -} - -func (x Code) BaseResponseWithMessage(msg string) *BaseResponse { - return NewBaseResponseWithMessage(x, msg) -} - -func (x Code) BaseResponseWithError(err error) *BaseResponse { - return NewBaseResponseWithMessage(x, err.Error()) -} diff --git a/api/transport/response/response.pb.go b/api/transport/response/response.pb.go deleted file mode 100644 index a582c0c..0000000 --- a/api/transport/response/response.pb.go +++ /dev/null @@ -1,279 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.4 -// source: api/transport/response/response.proto - -package response - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Code int32 - -const ( - Code_OK Code = 0 - // common error codes - Code_InternalError Code = 10001 - Code_InvalidParams Code = 10002 - Code_DBError Code = 10003 - Code_CacheError Code = 10004 - // user error codes - Code_UserNotExist Code = 20001 - Code_UserExist Code = 20002 - Code_InvalidUsernameOrPassword Code = 20003 - // relation error codes - Code_RelationNotExist Code = 30001 - Code_RelationExist Code = 30002 - Code_InvalidUpdateRelationAction Code = 30003 - // friend request error codes - Code_FriendRequestNotExist Code = 31001 - Code_FriendRequestStatusError Code = 31002 - // push server error codes - Code_UserNotOnline Code = 40001 -) - -// Enum value maps for Code. -var ( - Code_name = map[int32]string{ - 0: "OK", - 10001: "InternalError", - 10002: "InvalidParams", - 10003: "DBError", - 10004: "CacheError", - 20001: "UserNotExist", - 20002: "UserExist", - 20003: "InvalidUsernameOrPassword", - 30001: "RelationNotExist", - 30002: "RelationExist", - 30003: "InvalidUpdateRelationAction", - 31001: "FriendRequestNotExist", - 31002: "FriendRequestStatusError", - 40001: "UserNotOnline", - } - Code_value = map[string]int32{ - "OK": 0, - "InternalError": 10001, - "InvalidParams": 10002, - "DBError": 10003, - "CacheError": 10004, - "UserNotExist": 20001, - "UserExist": 20002, - "InvalidUsernameOrPassword": 20003, - "RelationNotExist": 30001, - "RelationExist": 30002, - "InvalidUpdateRelationAction": 30003, - "FriendRequestNotExist": 31001, - "FriendRequestStatusError": 31002, - "UserNotOnline": 40001, - } -) - -func (x Code) Enum() *Code { - p := new(Code) - *p = x - return p -} - -func (x Code) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Code) Descriptor() protoreflect.EnumDescriptor { - return file_api_transport_response_response_proto_enumTypes[0].Descriptor() -} - -func (Code) Type() protoreflect.EnumType { - return &file_api_transport_response_response_proto_enumTypes[0] -} - -func (x Code) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Code.Descriptor instead. -func (Code) EnumDescriptor() ([]byte, []int) { - return file_api_transport_response_response_proto_rawDescGZIP(), []int{0} -} - -// BaseResponse use as define response code and message -type BaseResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Code Code `protobuf:"varint,1,opt,name=code,proto3,enum=api.transport.response.Code" json:"code,omitempty"` - Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` -} - -func (x *BaseResponse) Reset() { - *x = BaseResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_transport_response_response_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BaseResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BaseResponse) ProtoMessage() {} - -func (x *BaseResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_transport_response_response_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 BaseResponse.ProtoReflect.Descriptor instead. -func (*BaseResponse) Descriptor() ([]byte, []int) { - return file_api_transport_response_response_proto_rawDescGZIP(), []int{0} -} - -func (x *BaseResponse) GetCode() Code { - if x != nil { - return x.Code - } - return Code_OK -} - -func (x *BaseResponse) GetReason() string { - if x != nil { - return x.Reason - } - return "" -} - -func (x *BaseResponse) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -var File_api_transport_response_response_proto protoreflect.FileDescriptor - -var file_api_transport_response_response_proto_rawDesc = []byte{ - 0x0a, 0x25, 0x61, 0x70, 0x69, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, - 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x72, 0x0a, 0x0c, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x30, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x2a, 0xbd, 0x02, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, - 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x91, 0x4e, 0x12, 0x12, 0x0a, 0x0d, 0x49, 0x6e, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0x92, 0x4e, 0x12, 0x0c, 0x0a, 0x07, - 0x44, 0x42, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x93, 0x4e, 0x12, 0x0f, 0x0a, 0x0a, 0x43, 0x61, - 0x63, 0x68, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x94, 0x4e, 0x12, 0x12, 0x0a, 0x0c, 0x55, - 0x73, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xa1, 0x9c, 0x01, 0x12, - 0x0f, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xa2, 0x9c, 0x01, - 0x12, 0x1f, 0x0a, 0x19, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x55, 0x73, 0x65, 0x72, 0x6e, - 0x61, 0x6d, 0x65, 0x4f, 0x72, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x10, 0xa3, 0x9c, - 0x01, 0x12, 0x16, 0x0a, 0x10, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x6f, 0x74, - 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xb1, 0xea, 0x01, 0x12, 0x13, 0x0a, 0x0d, 0x52, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xb2, 0xea, 0x01, 0x12, 0x21, - 0x0a, 0x1b, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0xb3, 0xea, - 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x99, 0xf2, 0x01, 0x12, 0x1e, - 0x0a, 0x18, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x9a, 0xf2, 0x01, 0x12, 0x13, - 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x10, - 0xc1, 0xb8, 0x02, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x79, 0x75, 0x73, 0x61, 0x6e, 0x6b, 0x2f, 0x67, 0x6f, 0x69, 0x6d, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_transport_response_response_proto_rawDescOnce sync.Once - file_api_transport_response_response_proto_rawDescData = file_api_transport_response_response_proto_rawDesc -) - -func file_api_transport_response_response_proto_rawDescGZIP() []byte { - file_api_transport_response_response_proto_rawDescOnce.Do(func() { - file_api_transport_response_response_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_transport_response_response_proto_rawDescData) - }) - return file_api_transport_response_response_proto_rawDescData -} - -var file_api_transport_response_response_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_api_transport_response_response_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_api_transport_response_response_proto_goTypes = []interface{}{ - (Code)(0), // 0: api.transport.response.Code - (*BaseResponse)(nil), // 1: api.transport.response.BaseResponse -} -var file_api_transport_response_response_proto_depIdxs = []int32{ - 0, // 0: api.transport.response.BaseResponse.code:type_name -> api.transport.response.Code - 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_transport_response_response_proto_init() } -func file_api_transport_response_response_proto_init() { - if File_api_transport_response_response_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_transport_response_response_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BaseResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_transport_response_response_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_api_transport_response_response_proto_goTypes, - DependencyIndexes: file_api_transport_response_response_proto_depIdxs, - EnumInfos: file_api_transport_response_response_proto_enumTypes, - MessageInfos: file_api_transport_response_response_proto_msgTypes, - }.Build() - File_api_transport_response_response_proto = out.File - file_api_transport_response_response_proto_rawDesc = nil - file_api_transport_response_response_proto_goTypes = nil - file_api_transport_response_response_proto_depIdxs = nil -} diff --git a/api/transport/response/response.pb.validate.go b/api/transport/response/response.pb.validate.go deleted file mode 100644 index 4f30c72..0000000 --- a/api/transport/response/response.pb.validate.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: api/transport/response/response.proto - -package response - -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 BaseResponse 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 *BaseResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BaseResponse 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 BaseResponseMultiError, or -// nil if none found. -func (m *BaseResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *BaseResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Code - - // no validation rules for Reason - - // no validation rules for Message - - if len(errors) > 0 { - return BaseResponseMultiError(errors) - } - - return nil -} - -// BaseResponseMultiError is an error wrapping multiple validation errors -// returned by BaseResponse.ValidateAll() if the designated constraints aren't met. -type BaseResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BaseResponseMultiError) 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 BaseResponseMultiError) AllErrors() []error { return m } - -// BaseResponseValidationError is the validation error returned by -// BaseResponse.Validate if the designated constraints aren't met. -type BaseResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BaseResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BaseResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BaseResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BaseResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BaseResponseValidationError) ErrorName() string { return "BaseResponseValidationError" } - -// Error satisfies the builtin error interface -func (e BaseResponseValidationError) 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 %sBaseResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BaseResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BaseResponseValidationError{} diff --git a/api/transport/response/response.proto b/api/transport/response/response.proto deleted file mode 100644 index cb3ee8b..0000000 --- a/api/transport/response/response.proto +++ /dev/null @@ -1,38 +0,0 @@ -syntax = "proto3"; - -package api.transport.response; -option go_package = "github.com/yusank/goim/api/transport/response"; - -enum Code { - OK = 0; - - // common error codes - InternalError = 10001; - InvalidParams = 10002; - DBError = 10003; - CacheError = 10004; - - // user error codes - UserNotExist = 20001; - UserExist = 20002; - InvalidUsernameOrPassword = 20003; - - // relation error codes - RelationNotExist = 30001; - RelationExist = 30002; - InvalidUpdateRelationAction = 30003; - - // friend request error codes - FriendRequestNotExist = 31001; - FriendRequestStatusError = 31002; - - // push server error codes - UserNotOnline = 40001; -} - -// BaseResponse use as define response code and message -message BaseResponse { - Code code = 1; - string reason = 2; - string message = 3; -} diff --git a/api/user/friend/v1/friend.ex.go b/api/user/friend/v1/friend.ex.go deleted file mode 100644 index 74132c4..0000000 --- a/api/user/friend/v1/friend.ex.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code Written Manually - -package v1 - -// updateStatusMap is a list of valid actions that can be performed on a user relation -// { { curFriendStatus: {newFriendStatus: true } } -var updateStatusMap = map[FriendStatus]map[FriendStatus]bool{ - FriendStatus_FRIEND: { - FriendStatus_STRANGER: true, - FriendStatus_BLOCKED: true, - }, - FriendStatus_STRANGER: {}, // you can't be change status when you are stranger - FriendStatus_BLOCKED: { - FriendStatus_UNBLOCKED: true, // you can unblock when you are blocked - }, -} - -// CanUpdateStatus checks if a friend status can be updated to another status -func (x FriendStatus) CanUpdateStatus(targetStatus FriendStatus) bool { - temp, ok := updateStatusMap[x] - if !ok { - return false - } - - return temp[targetStatus] -} diff --git a/api/user/friend/v1/friend.pb.go b/api/user/friend/v1/friend.pb.go deleted file mode 100644 index ce6d820..0000000 --- a/api/user/friend/v1/friend.pb.go +++ /dev/null @@ -1,1566 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.4 -// source: api/user/friend/v1/friend.proto - -package v1 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - response "github.com/go-goim/core/api/transport/response" - 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 FriendStatus int32 - -const ( - // Friend as default status - FriendStatus_FRIEND FriendStatus = 0 - // Stranger when delete friend - FriendStatus_STRANGER FriendStatus = 1 - // Blocked when block friend - FriendStatus_BLOCKED FriendStatus = 2 - // Unblock when unblock friend - // unblock status won't be in database only use when update friend status - FriendStatus_UNBLOCKED FriendStatus = 3 -) - -// Enum value maps for FriendStatus. -var ( - FriendStatus_name = map[int32]string{ - 0: "FRIEND", - 1: "STRANGER", - 2: "BLOCKED", - 3: "UNBLOCKED", - } - FriendStatus_value = map[string]int32{ - "FRIEND": 0, - "STRANGER": 1, - "BLOCKED": 2, - "UNBLOCKED": 3, - } -) - -func (x FriendStatus) Enum() *FriendStatus { - p := new(FriendStatus) - *p = x - return p -} - -func (x FriendStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FriendStatus) Descriptor() protoreflect.EnumDescriptor { - return file_api_user_friend_v1_friend_proto_enumTypes[0].Descriptor() -} - -func (FriendStatus) Type() protoreflect.EnumType { - return &file_api_user_friend_v1_friend_proto_enumTypes[0] -} - -func (x FriendStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use FriendStatus.Descriptor instead. -func (FriendStatus) EnumDescriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{0} -} - -type FriendRequestStatus int32 - -const ( - // Friend request as default status - FriendRequestStatus_REQUESTED FriendRequestStatus = 0 - // Friend request as accepted - FriendRequestStatus_ACCEPTED FriendRequestStatus = 1 - // Friend request as rejected - FriendRequestStatus_REJECTED FriendRequestStatus = 2 -) - -// Enum value maps for FriendRequestStatus. -var ( - FriendRequestStatus_name = map[int32]string{ - 0: "REQUESTED", - 1: "ACCEPTED", - 2: "REJECTED", - } - FriendRequestStatus_value = map[string]int32{ - "REQUESTED": 0, - "ACCEPTED": 1, - "REJECTED": 2, - } -) - -func (x FriendRequestStatus) Enum() *FriendRequestStatus { - p := new(FriendRequestStatus) - *p = x - return p -} - -func (x FriendRequestStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FriendRequestStatus) Descriptor() protoreflect.EnumDescriptor { - return file_api_user_friend_v1_friend_proto_enumTypes[1].Descriptor() -} - -func (FriendRequestStatus) Type() protoreflect.EnumType { - return &file_api_user_friend_v1_friend_proto_enumTypes[1] -} - -func (x FriendRequestStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use FriendRequestStatus.Descriptor instead. -func (FriendRequestStatus) EnumDescriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{1} -} - -type AddFriendStatus int32 - -const ( - AddFriendStatus_SEND_REQUEST_SUCCESS AddFriendStatus = 0 - AddFriendStatus_ALREADY_SENT_REQUEST AddFriendStatus = 1 - AddFriendStatus_ADD_FRIEND_SUCCESS AddFriendStatus = 2 - AddFriendStatus_BLOCKED_BY_ME AddFriendStatus = 3 - AddFriendStatus_BLOCKED_BY_FRIEND AddFriendStatus = 4 -) - -// Enum value maps for AddFriendStatus. -var ( - AddFriendStatus_name = map[int32]string{ - 0: "SEND_REQUEST_SUCCESS", - 1: "ALREADY_SENT_REQUEST", - 2: "ADD_FRIEND_SUCCESS", - 3: "BLOCKED_BY_ME", - 4: "BLOCKED_BY_FRIEND", - } - AddFriendStatus_value = map[string]int32{ - "SEND_REQUEST_SUCCESS": 0, - "ALREADY_SENT_REQUEST": 1, - "ADD_FRIEND_SUCCESS": 2, - "BLOCKED_BY_ME": 3, - "BLOCKED_BY_FRIEND": 4, - } -) - -func (x AddFriendStatus) Enum() *AddFriendStatus { - p := new(AddFriendStatus) - *p = x - return p -} - -func (x AddFriendStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (AddFriendStatus) Descriptor() protoreflect.EnumDescriptor { - return file_api_user_friend_v1_friend_proto_enumTypes[2].Descriptor() -} - -func (AddFriendStatus) Type() protoreflect.EnumType { - return &file_api_user_friend_v1_friend_proto_enumTypes[2] -} - -func (x AddFriendStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use AddFriendStatus.Descriptor instead. -func (AddFriendStatus) EnumDescriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{2} -} - -type ConfirmFriendRequestAction int32 - -const ( - ConfirmFriendRequestAction_ACCEPT ConfirmFriendRequestAction = 0 // accept friend request - ConfirmFriendRequestAction_REJECT ConfirmFriendRequestAction = 1 // reject friend request -) - -// Enum value maps for ConfirmFriendRequestAction. -var ( - ConfirmFriendRequestAction_name = map[int32]string{ - 0: "ACCEPT", - 1: "REJECT", - } - ConfirmFriendRequestAction_value = map[string]int32{ - "ACCEPT": 0, - "REJECT": 1, - } -) - -func (x ConfirmFriendRequestAction) Enum() *ConfirmFriendRequestAction { - p := new(ConfirmFriendRequestAction) - *p = x - return p -} - -func (x ConfirmFriendRequestAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ConfirmFriendRequestAction) Descriptor() protoreflect.EnumDescriptor { - return file_api_user_friend_v1_friend_proto_enumTypes[3].Descriptor() -} - -func (ConfirmFriendRequestAction) Type() protoreflect.EnumType { - return &file_api_user_friend_v1_friend_proto_enumTypes[3] -} - -func (x ConfirmFriendRequestAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ConfirmFriendRequestAction.Descriptor instead. -func (ConfirmFriendRequestAction) EnumDescriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{3} -} - -type Friend struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - FriendUid string `protobuf:"bytes,2,opt,name=friend_uid,json=friendUid,proto3" json:"friend_uid,omitempty"` - FriendName string `protobuf:"bytes,3,opt,name=friend_name,json=friendName,proto3" json:"friend_name,omitempty"` - FriendAvatar string `protobuf:"bytes,4,opt,name=friend_avatar,json=friendAvatar,proto3" json:"friend_avatar,omitempty"` - Status FriendStatus `protobuf:"varint,5,opt,name=status,proto3,enum=api.user.v1.FriendStatus" json:"status,omitempty"` - CreatedAt int64 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - UpdatedAt int64 `protobuf:"varint,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` -} - -func (x *Friend) Reset() { - *x = Friend{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Friend) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Friend) ProtoMessage() {} - -func (x *Friend) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 Friend.ProtoReflect.Descriptor instead. -func (*Friend) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{0} -} - -func (x *Friend) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *Friend) GetFriendUid() string { - if x != nil { - return x.FriendUid - } - return "" -} - -func (x *Friend) GetFriendName() string { - if x != nil { - return x.FriendName - } - return "" -} - -func (x *Friend) GetFriendAvatar() string { - if x != nil { - return x.FriendAvatar - } - return "" -} - -func (x *Friend) GetStatus() FriendStatus { - if x != nil { - return x.Status - } - return FriendStatus_FRIEND -} - -func (x *Friend) GetCreatedAt() int64 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *Friend) GetUpdatedAt() int64 { - if x != nil { - return x.UpdatedAt - } - return 0 -} - -type UpdateFriendStatusRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Info *BaseFriendRequest `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"` - Status FriendStatus `protobuf:"varint,2,opt,name=status,proto3,enum=api.user.v1.FriendStatus" json:"status,omitempty"` -} - -func (x *UpdateFriendStatusRequest) Reset() { - *x = UpdateFriendStatusRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateFriendStatusRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateFriendStatusRequest) ProtoMessage() {} - -func (x *UpdateFriendStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 UpdateFriendStatusRequest.ProtoReflect.Descriptor instead. -func (*UpdateFriendStatusRequest) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{1} -} - -func (x *UpdateFriendStatusRequest) GetInfo() *BaseFriendRequest { - if x != nil { - return x.Info - } - return nil -} - -func (x *UpdateFriendStatusRequest) GetStatus() FriendStatus { - if x != nil { - return x.Status - } - return FriendStatus_FRIEND -} - -type GetFriendResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - Friend *Friend `protobuf:"bytes,2,opt,name=friend,proto3" json:"friend,omitempty"` -} - -func (x *GetFriendResponse) Reset() { - *x = GetFriendResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFriendResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFriendResponse) ProtoMessage() {} - -func (x *GetFriendResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 GetFriendResponse.ProtoReflect.Descriptor instead. -func (*GetFriendResponse) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{2} -} - -func (x *GetFriendResponse) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *GetFriendResponse) GetFriend() *Friend { - if x != nil { - return x.Friend - } - return nil -} - -type QueryFriendListRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` -} - -func (x *QueryFriendListRequest) Reset() { - *x = QueryFriendListRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryFriendListRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryFriendListRequest) ProtoMessage() {} - -func (x *QueryFriendListRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 QueryFriendListRequest.ProtoReflect.Descriptor instead. -func (*QueryFriendListRequest) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{3} -} - -func (x *QueryFriendListRequest) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -type QueryFriendListResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - FriendList []*Friend `protobuf:"bytes,2,rep,name=friend_list,json=friendList,proto3" json:"friend_list,omitempty"` -} - -func (x *QueryFriendListResponse) Reset() { - *x = QueryFriendListResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryFriendListResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryFriendListResponse) ProtoMessage() {} - -func (x *QueryFriendListResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 QueryFriendListResponse.ProtoReflect.Descriptor instead. -func (*QueryFriendListResponse) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{4} -} - -func (x *QueryFriendListResponse) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *QueryFriendListResponse) GetFriendList() []*Friend { - if x != nil { - return x.FriendList - } - return nil -} - -// FriendRequest is the request data for adding friend -type FriendRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` - FriendUid string `protobuf:"bytes,3,opt,name=friend_uid,json=friendUid,proto3" json:"friend_uid,omitempty"` - Status FriendRequestStatus `protobuf:"varint,4,opt,name=status,proto3,enum=api.user.v1.FriendRequestStatus" json:"status,omitempty"` - CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - UpdatedAt int64 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` - // friend info for view - FriendName string `protobuf:"bytes,7,opt,name=friend_name,json=friendName,proto3" json:"friend_name,omitempty"` - FriendAvatar string `protobuf:"bytes,8,opt,name=friend_avatar,json=friendAvatar,proto3" json:"friend_avatar,omitempty"` -} - -func (x *FriendRequest) Reset() { - *x = FriendRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FriendRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FriendRequest) ProtoMessage() {} - -func (x *FriendRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 FriendRequest.ProtoReflect.Descriptor instead. -func (*FriendRequest) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{5} -} - -func (x *FriendRequest) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *FriendRequest) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *FriendRequest) GetFriendUid() string { - if x != nil { - return x.FriendUid - } - return "" -} - -func (x *FriendRequest) GetStatus() FriendRequestStatus { - if x != nil { - return x.Status - } - return FriendRequestStatus_REQUESTED -} - -func (x *FriendRequest) GetCreatedAt() int64 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *FriendRequest) GetUpdatedAt() int64 { - if x != nil { - return x.UpdatedAt - } - return 0 -} - -func (x *FriendRequest) GetFriendName() string { - if x != nil { - return x.FriendName - } - return "" -} - -func (x *FriendRequest) GetFriendAvatar() string { - if x != nil { - return x.FriendAvatar - } - return "" -} - -type AddFriendRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - FriendUid string `protobuf:"bytes,2,opt,name=friend_uid,json=friendUid,proto3" json:"friend_uid,omitempty"` -} - -func (x *AddFriendRequest) Reset() { - *x = AddFriendRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddFriendRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddFriendRequest) ProtoMessage() {} - -func (x *AddFriendRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 AddFriendRequest.ProtoReflect.Descriptor instead. -func (*AddFriendRequest) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{6} -} - -func (x *AddFriendRequest) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *AddFriendRequest) GetFriendUid() string { - if x != nil { - return x.FriendUid - } - return "" -} - -type BaseFriendRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - FriendUid string `protobuf:"bytes,2,opt,name=friend_uid,json=friendUid,proto3" json:"friend_uid,omitempty"` -} - -func (x *BaseFriendRequest) Reset() { - *x = BaseFriendRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BaseFriendRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BaseFriendRequest) ProtoMessage() {} - -func (x *BaseFriendRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 BaseFriendRequest.ProtoReflect.Descriptor instead. -func (*BaseFriendRequest) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{7} -} - -func (x *BaseFriendRequest) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *BaseFriendRequest) GetFriendUid() string { - if x != nil { - return x.FriendUid - } - return "" -} - -type AddFriendResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - Result *AddFriendResult `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` -} - -func (x *AddFriendResponse) Reset() { - *x = AddFriendResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddFriendResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddFriendResponse) ProtoMessage() {} - -func (x *AddFriendResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 AddFriendResponse.ProtoReflect.Descriptor instead. -func (*AddFriendResponse) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{8} -} - -func (x *AddFriendResponse) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *AddFriendResponse) GetResult() *AddFriendResult { - if x != nil { - return x.Result - } - return nil -} - -type AddFriendResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status AddFriendStatus `protobuf:"varint,1,opt,name=status,proto3,enum=api.user.v1.AddFriendStatus" json:"status,omitempty"` - FriendRequest *FriendRequest `protobuf:"bytes,2,opt,name=friend_request,json=friendRequest,proto3" json:"friend_request,omitempty"` -} - -func (x *AddFriendResult) Reset() { - *x = AddFriendResult{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddFriendResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddFriendResult) ProtoMessage() {} - -func (x *AddFriendResult) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 AddFriendResult.ProtoReflect.Descriptor instead. -func (*AddFriendResult) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{9} -} - -func (x *AddFriendResult) GetStatus() AddFriendStatus { - if x != nil { - return x.Status - } - return AddFriendStatus_SEND_REQUEST_SUCCESS -} - -func (x *AddFriendResult) GetFriendRequest() *FriendRequest { - if x != nil { - return x.FriendRequest - } - return nil -} - -type ConfirmFriendRequestReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - FriendRequestId int64 `protobuf:"varint,2,opt,name=friend_request_id,json=friendRequestId,proto3" json:"friend_request_id,omitempty"` - Action ConfirmFriendRequestAction `protobuf:"varint,3,opt,name=action,proto3,enum=api.user.v1.ConfirmFriendRequestAction" json:"action,omitempty"` -} - -func (x *ConfirmFriendRequestReq) Reset() { - *x = ConfirmFriendRequestReq{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConfirmFriendRequestReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConfirmFriendRequestReq) ProtoMessage() {} - -func (x *ConfirmFriendRequestReq) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 ConfirmFriendRequestReq.ProtoReflect.Descriptor instead. -func (*ConfirmFriendRequestReq) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{10} -} - -func (x *ConfirmFriendRequestReq) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *ConfirmFriendRequestReq) GetFriendRequestId() int64 { - if x != nil { - return x.FriendRequestId - } - return 0 -} - -func (x *ConfirmFriendRequestReq) GetAction() ConfirmFriendRequestAction { - if x != nil { - return x.Action - } - return ConfirmFriendRequestAction_ACCEPT -} - -type GetFriendRequestResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - FriendRequest *FriendRequest `protobuf:"bytes,2,opt,name=friend_request,json=friendRequest,proto3" json:"friend_request,omitempty"` -} - -func (x *GetFriendRequestResponse) Reset() { - *x = GetFriendRequestResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFriendRequestResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFriendRequestResponse) ProtoMessage() {} - -func (x *GetFriendRequestResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 GetFriendRequestResponse.ProtoReflect.Descriptor instead. -func (*GetFriendRequestResponse) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{11} -} - -func (x *GetFriendRequestResponse) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *GetFriendRequestResponse) GetFriendRequest() *FriendRequest { - if x != nil { - return x.FriendRequest - } - return nil -} - -type QueryFriendRequestListRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` -} - -func (x *QueryFriendRequestListRequest) Reset() { - *x = QueryFriendRequestListRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryFriendRequestListRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryFriendRequestListRequest) ProtoMessage() {} - -func (x *QueryFriendRequestListRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 QueryFriendRequestListRequest.ProtoReflect.Descriptor instead. -func (*QueryFriendRequestListRequest) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{12} -} - -func (x *QueryFriendRequestListRequest) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -type QueryFriendRequestListResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - FriendRequestList []*FriendRequest `protobuf:"bytes,2,rep,name=friend_request_list,json=friendRequestList,proto3" json:"friend_request_list,omitempty"` -} - -func (x *QueryFriendRequestListResponse) Reset() { - *x = QueryFriendRequestListResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_friend_v1_friend_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryFriendRequestListResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryFriendRequestListResponse) ProtoMessage() {} - -func (x *QueryFriendRequestListResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_user_friend_v1_friend_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 QueryFriendRequestListResponse.ProtoReflect.Descriptor instead. -func (*QueryFriendRequestListResponse) Descriptor() ([]byte, []int) { - return file_api_user_friend_v1_friend_proto_rawDescGZIP(), []int{13} -} - -func (x *QueryFriendRequestListResponse) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *QueryFriendRequestListResponse) GetFriendRequestList() []*FriendRequest { - if x != nil { - return x.FriendRequestList - } - return nil -} - -var File_api_user_friend_v1_friend_proto protoreflect.FileDescriptor - -var file_api_user_friend_v1_friend_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0b, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 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, 0x1a, 0x21, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, - 0x72, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf0, 0x01, 0x0a, 0x06, 0x46, - 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x5f, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x55, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x5f, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x31, 0x0a, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x03, 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, 0x07, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x82, 0x01, - 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x04, 0x69, - 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, - 0x31, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x66, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, - 0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x22, 0x35, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, - 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x14, 0x18, 0x18, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x91, - 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, - 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x0a, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, - 0x73, 0x74, 0x22, 0x8e, 0x02, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x5f, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x55, 0x69, 0x64, 0x12, 0x38, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x03, 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, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1f, 0x0a, - 0x0b, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, - 0x0a, 0x0d, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x22, 0x59, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x14, 0x18, 0x18, 0x52, - 0x03, 0x75, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0a, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x75, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, - 0x14, 0x18, 0x18, 0x52, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x55, 0x69, 0x64, 0x22, 0x5a, - 0x0a, 0x11, 0x42, 0x61, 0x73, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x09, 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x14, 0x18, 0x18, 0x52, 0x03, 0x75, 0x69, 0x64, - 0x12, 0x28, 0x0a, 0x0a, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x75, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x14, 0x18, 0x18, 0x52, - 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x55, 0x69, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x11, 0x41, - 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, - 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, - 0x2e, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x8a, 0x01, 0x0a, 0x0f, 0x41, 0x64, 0x64, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x34, 0x0a, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x46, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x41, 0x0a, 0x0e, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb6, 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, - 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x12, 0x1b, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, - 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x14, 0x18, 0x18, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x33, - 0x0a, 0x11, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, - 0x20, 0x00, 0x52, 0x0f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, - 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, - 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9f, - 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, - 0x0e, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x52, 0x0d, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x3c, 0x0a, 0x1d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, - 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x14, 0x18, 0x18, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0xae, - 0x01, 0x0a, 0x1e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x13, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x46, - 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x11, 0x66, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x2a, - 0x44, 0x0a, 0x0c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x0a, 0x0a, 0x06, 0x46, 0x52, 0x49, 0x45, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, - 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x4c, 0x4f, - 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x42, 0x4c, 0x4f, 0x43, - 0x4b, 0x45, 0x44, 0x10, 0x03, 0x2a, 0x40, 0x0a, 0x13, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, - 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x41, - 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x4a, - 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x87, 0x01, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x46, - 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x14, 0x53, - 0x45, 0x4e, 0x44, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x53, 0x55, 0x43, 0x43, - 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, - 0x5f, 0x53, 0x45, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, - 0x16, 0x0a, 0x12, 0x41, 0x44, 0x44, 0x5f, 0x46, 0x52, 0x49, 0x45, 0x4e, 0x44, 0x5f, 0x53, 0x55, - 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x42, 0x4c, 0x4f, 0x43, 0x4b, - 0x45, 0x44, 0x5f, 0x42, 0x59, 0x5f, 0x4d, 0x45, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x42, 0x4c, - 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x5f, 0x42, 0x59, 0x5f, 0x46, 0x52, 0x49, 0x45, 0x4e, 0x44, 0x10, - 0x04, 0x2a, 0x34, 0x0a, 0x1a, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x52, - 0x45, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x01, 0x32, 0xee, 0x05, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4a, 0x0a, 0x09, 0x41, 0x64, 0x64, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, - 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x72, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x10, 0x47, 0x65, 0x74, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x65, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, - 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2a, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, - 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x08, 0x49, - 0x73, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, - 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, - 0x09, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0f, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x23, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x17, 0x5a, 0x15, 0x61, 0x70, 0x69, 0x2f, - 0x75, 0x73, 0x65, 0x72, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x76, 0x31, 0x3b, 0x76, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_user_friend_v1_friend_proto_rawDescOnce sync.Once - file_api_user_friend_v1_friend_proto_rawDescData = file_api_user_friend_v1_friend_proto_rawDesc -) - -func file_api_user_friend_v1_friend_proto_rawDescGZIP() []byte { - file_api_user_friend_v1_friend_proto_rawDescOnce.Do(func() { - file_api_user_friend_v1_friend_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_user_friend_v1_friend_proto_rawDescData) - }) - return file_api_user_friend_v1_friend_proto_rawDescData -} - -var file_api_user_friend_v1_friend_proto_enumTypes = make([]protoimpl.EnumInfo, 4) -var file_api_user_friend_v1_friend_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_api_user_friend_v1_friend_proto_goTypes = []interface{}{ - (FriendStatus)(0), // 0: api.user.v1.FriendStatus - (FriendRequestStatus)(0), // 1: api.user.v1.FriendRequestStatus - (AddFriendStatus)(0), // 2: api.user.v1.AddFriendStatus - (ConfirmFriendRequestAction)(0), // 3: api.user.v1.ConfirmFriendRequestAction - (*Friend)(nil), // 4: api.user.v1.Friend - (*UpdateFriendStatusRequest)(nil), // 5: api.user.v1.UpdateFriendStatusRequest - (*GetFriendResponse)(nil), // 6: api.user.v1.GetFriendResponse - (*QueryFriendListRequest)(nil), // 7: api.user.v1.QueryFriendListRequest - (*QueryFriendListResponse)(nil), // 8: api.user.v1.QueryFriendListResponse - (*FriendRequest)(nil), // 9: api.user.v1.FriendRequest - (*AddFriendRequest)(nil), // 10: api.user.v1.AddFriendRequest - (*BaseFriendRequest)(nil), // 11: api.user.v1.BaseFriendRequest - (*AddFriendResponse)(nil), // 12: api.user.v1.AddFriendResponse - (*AddFriendResult)(nil), // 13: api.user.v1.AddFriendResult - (*ConfirmFriendRequestReq)(nil), // 14: api.user.v1.ConfirmFriendRequestReq - (*GetFriendRequestResponse)(nil), // 15: api.user.v1.GetFriendRequestResponse - (*QueryFriendRequestListRequest)(nil), // 16: api.user.v1.QueryFriendRequestListRequest - (*QueryFriendRequestListResponse)(nil), // 17: api.user.v1.QueryFriendRequestListResponse - (*response.BaseResponse)(nil), // 18: api.transport.response.BaseResponse -} -var file_api_user_friend_v1_friend_proto_depIdxs = []int32{ - 0, // 0: api.user.v1.Friend.status:type_name -> api.user.v1.FriendStatus - 11, // 1: api.user.v1.UpdateFriendStatusRequest.info:type_name -> api.user.v1.BaseFriendRequest - 0, // 2: api.user.v1.UpdateFriendStatusRequest.status:type_name -> api.user.v1.FriendStatus - 18, // 3: api.user.v1.GetFriendResponse.response:type_name -> api.transport.response.BaseResponse - 4, // 4: api.user.v1.GetFriendResponse.friend:type_name -> api.user.v1.Friend - 18, // 5: api.user.v1.QueryFriendListResponse.response:type_name -> api.transport.response.BaseResponse - 4, // 6: api.user.v1.QueryFriendListResponse.friend_list:type_name -> api.user.v1.Friend - 1, // 7: api.user.v1.FriendRequest.status:type_name -> api.user.v1.FriendRequestStatus - 18, // 8: api.user.v1.AddFriendResponse.response:type_name -> api.transport.response.BaseResponse - 13, // 9: api.user.v1.AddFriendResponse.result:type_name -> api.user.v1.AddFriendResult - 2, // 10: api.user.v1.AddFriendResult.status:type_name -> api.user.v1.AddFriendStatus - 9, // 11: api.user.v1.AddFriendResult.friend_request:type_name -> api.user.v1.FriendRequest - 3, // 12: api.user.v1.ConfirmFriendRequestReq.action:type_name -> api.user.v1.ConfirmFriendRequestAction - 18, // 13: api.user.v1.GetFriendRequestResponse.response:type_name -> api.transport.response.BaseResponse - 9, // 14: api.user.v1.GetFriendRequestResponse.friend_request:type_name -> api.user.v1.FriendRequest - 18, // 15: api.user.v1.QueryFriendRequestListResponse.response:type_name -> api.transport.response.BaseResponse - 9, // 16: api.user.v1.QueryFriendRequestListResponse.friend_request_list:type_name -> api.user.v1.FriendRequest - 10, // 17: api.user.v1.FriendService.AddFriend:input_type -> api.user.v1.AddFriendRequest - 14, // 18: api.user.v1.FriendService.ConfirmFriendRequest:input_type -> api.user.v1.ConfirmFriendRequestReq - 11, // 19: api.user.v1.FriendService.GetFriendRequest:input_type -> api.user.v1.BaseFriendRequest - 16, // 20: api.user.v1.FriendService.QueryFriendRequestList:input_type -> api.user.v1.QueryFriendRequestListRequest - 5, // 21: api.user.v1.FriendService.UpdateFriendStatus:input_type -> api.user.v1.UpdateFriendStatusRequest - 11, // 22: api.user.v1.FriendService.IsFriend:input_type -> api.user.v1.BaseFriendRequest - 11, // 23: api.user.v1.FriendService.GetFriend:input_type -> api.user.v1.BaseFriendRequest - 7, // 24: api.user.v1.FriendService.QueryFriendList:input_type -> api.user.v1.QueryFriendListRequest - 12, // 25: api.user.v1.FriendService.AddFriend:output_type -> api.user.v1.AddFriendResponse - 18, // 26: api.user.v1.FriendService.ConfirmFriendRequest:output_type -> api.transport.response.BaseResponse - 15, // 27: api.user.v1.FriendService.GetFriendRequest:output_type -> api.user.v1.GetFriendRequestResponse - 17, // 28: api.user.v1.FriendService.QueryFriendRequestList:output_type -> api.user.v1.QueryFriendRequestListResponse - 18, // 29: api.user.v1.FriendService.UpdateFriendStatus:output_type -> api.transport.response.BaseResponse - 18, // 30: api.user.v1.FriendService.IsFriend:output_type -> api.transport.response.BaseResponse - 6, // 31: api.user.v1.FriendService.GetFriend:output_type -> api.user.v1.GetFriendResponse - 8, // 32: api.user.v1.FriendService.QueryFriendList:output_type -> api.user.v1.QueryFriendListResponse - 25, // [25:33] is the sub-list for method output_type - 17, // [17:25] is the sub-list for method input_type - 17, // [17:17] is the sub-list for extension type_name - 17, // [17:17] is the sub-list for extension extendee - 0, // [0:17] is the sub-list for field type_name -} - -func init() { file_api_user_friend_v1_friend_proto_init() } -func file_api_user_friend_v1_friend_proto_init() { - if File_api_user_friend_v1_friend_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_user_friend_v1_friend_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Friend); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateFriendStatusRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFriendResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryFriendListRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryFriendListResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FriendRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddFriendRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BaseFriendRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddFriendResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddFriendResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConfirmFriendRequestReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFriendRequestResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryFriendRequestListRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_friend_v1_friend_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryFriendRequestListResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_user_friend_v1_friend_proto_rawDesc, - NumEnums: 4, - NumMessages: 14, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_api_user_friend_v1_friend_proto_goTypes, - DependencyIndexes: file_api_user_friend_v1_friend_proto_depIdxs, - EnumInfos: file_api_user_friend_v1_friend_proto_enumTypes, - MessageInfos: file_api_user_friend_v1_friend_proto_msgTypes, - }.Build() - File_api_user_friend_v1_friend_proto = out.File - file_api_user_friend_v1_friend_proto_rawDesc = nil - file_api_user_friend_v1_friend_proto_goTypes = nil - file_api_user_friend_v1_friend_proto_depIdxs = nil -} diff --git a/api/user/friend/v1/friend.pb.validate.go b/api/user/friend/v1/friend.pb.validate.go deleted file mode 100644 index 9007b5f..0000000 --- a/api/user/friend/v1/friend.pb.validate.go +++ /dev/null @@ -1,1947 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: api/user/friend/v1/friend.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 Friend 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 *Friend) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Friend 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 FriendMultiError, or nil if none found. -func (m *Friend) ValidateAll() error { - return m.validate(true) -} - -func (m *Friend) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Uid - - // no validation rules for FriendUid - - // no validation rules for FriendName - - // no validation rules for FriendAvatar - - // no validation rules for Status - - // no validation rules for CreatedAt - - // no validation rules for UpdatedAt - - if len(errors) > 0 { - return FriendMultiError(errors) - } - - return nil -} - -// FriendMultiError is an error wrapping multiple validation errors returned by -// Friend.ValidateAll() if the designated constraints aren't met. -type FriendMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FriendMultiError) 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 FriendMultiError) AllErrors() []error { return m } - -// FriendValidationError is the validation error returned by Friend.Validate if -// the designated constraints aren't met. -type FriendValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FriendValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FriendValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FriendValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FriendValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FriendValidationError) ErrorName() string { return "FriendValidationError" } - -// Error satisfies the builtin error interface -func (e FriendValidationError) 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 %sFriend.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FriendValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FriendValidationError{} - -// Validate checks the field values on UpdateFriendStatusRequest 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 *UpdateFriendStatusRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateFriendStatusRequest 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 -// UpdateFriendStatusRequestMultiError, or nil if none found. -func (m *UpdateFriendStatusRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateFriendStatusRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetInfo()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UpdateFriendStatusRequestValidationError{ - field: "Info", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UpdateFriendStatusRequestValidationError{ - field: "Info", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetInfo()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UpdateFriendStatusRequestValidationError{ - field: "Info", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Status - - if len(errors) > 0 { - return UpdateFriendStatusRequestMultiError(errors) - } - - return nil -} - -// UpdateFriendStatusRequestMultiError is an error wrapping multiple validation -// errors returned by UpdateFriendStatusRequest.ValidateAll() if the -// designated constraints aren't met. -type UpdateFriendStatusRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateFriendStatusRequestMultiError) 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 UpdateFriendStatusRequestMultiError) AllErrors() []error { return m } - -// UpdateFriendStatusRequestValidationError is the validation error returned by -// UpdateFriendStatusRequest.Validate if the designated constraints aren't met. -type UpdateFriendStatusRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateFriendStatusRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateFriendStatusRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateFriendStatusRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateFriendStatusRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateFriendStatusRequestValidationError) ErrorName() string { - return "UpdateFriendStatusRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateFriendStatusRequestValidationError) 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 %sUpdateFriendStatusRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateFriendStatusRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateFriendStatusRequestValidationError{} - -// Validate checks the field values on GetFriendResponse 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 *GetFriendResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetFriendResponse 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 -// GetFriendResponseMultiError, or nil if none found. -func (m *GetFriendResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetFriendResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetFriendResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetFriendResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetFriendResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetFriend()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetFriendResponseValidationError{ - field: "Friend", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetFriendResponseValidationError{ - field: "Friend", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFriend()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetFriendResponseValidationError{ - field: "Friend", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetFriendResponseMultiError(errors) - } - - return nil -} - -// GetFriendResponseMultiError is an error wrapping multiple validation errors -// returned by GetFriendResponse.ValidateAll() if the designated constraints -// aren't met. -type GetFriendResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetFriendResponseMultiError) 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 GetFriendResponseMultiError) AllErrors() []error { return m } - -// GetFriendResponseValidationError is the validation error returned by -// GetFriendResponse.Validate if the designated constraints aren't met. -type GetFriendResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetFriendResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetFriendResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetFriendResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetFriendResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetFriendResponseValidationError) ErrorName() string { - return "GetFriendResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetFriendResponseValidationError) 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 %sGetFriendResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetFriendResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetFriendResponseValidationError{} - -// Validate checks the field values on QueryFriendListRequest 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 *QueryFriendListRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryFriendListRequest 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 -// QueryFriendListRequestMultiError, or nil if none found. -func (m *QueryFriendListRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryFriendListRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetUid()); l < 20 || l > 24 { - err := QueryFriendListRequestValidationError{ - field: "Uid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return QueryFriendListRequestMultiError(errors) - } - - return nil -} - -// QueryFriendListRequestMultiError is an error wrapping multiple validation -// errors returned by QueryFriendListRequest.ValidateAll() if the designated -// constraints aren't met. -type QueryFriendListRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryFriendListRequestMultiError) 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 QueryFriendListRequestMultiError) AllErrors() []error { return m } - -// QueryFriendListRequestValidationError is the validation error returned by -// QueryFriendListRequest.Validate if the designated constraints aren't met. -type QueryFriendListRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryFriendListRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryFriendListRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryFriendListRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryFriendListRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryFriendListRequestValidationError) ErrorName() string { - return "QueryFriendListRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e QueryFriendListRequestValidationError) 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 %sQueryFriendListRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryFriendListRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryFriendListRequestValidationError{} - -// Validate checks the field values on QueryFriendListResponse 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 *QueryFriendListResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryFriendListResponse 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 -// QueryFriendListResponseMultiError, or nil if none found. -func (m *QueryFriendListResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryFriendListResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QueryFriendListResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QueryFriendListResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return QueryFriendListResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetFriendList() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QueryFriendListResponseValidationError{ - field: fmt.Sprintf("FriendList[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QueryFriendListResponseValidationError{ - field: fmt.Sprintf("FriendList[%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 QueryFriendListResponseValidationError{ - field: fmt.Sprintf("FriendList[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return QueryFriendListResponseMultiError(errors) - } - - return nil -} - -// QueryFriendListResponseMultiError is an error wrapping multiple validation -// errors returned by QueryFriendListResponse.ValidateAll() if the designated -// constraints aren't met. -type QueryFriendListResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryFriendListResponseMultiError) 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 QueryFriendListResponseMultiError) AllErrors() []error { return m } - -// QueryFriendListResponseValidationError is the validation error returned by -// QueryFriendListResponse.Validate if the designated constraints aren't met. -type QueryFriendListResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryFriendListResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryFriendListResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryFriendListResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryFriendListResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryFriendListResponseValidationError) ErrorName() string { - return "QueryFriendListResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e QueryFriendListResponseValidationError) 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 %sQueryFriendListResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryFriendListResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryFriendListResponseValidationError{} - -// Validate checks the field values on FriendRequest 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 *FriendRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FriendRequest 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 FriendRequestMultiError, or -// nil if none found. -func (m *FriendRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *FriendRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Uid - - // no validation rules for FriendUid - - // no validation rules for Status - - // no validation rules for CreatedAt - - // no validation rules for UpdatedAt - - // no validation rules for FriendName - - // no validation rules for FriendAvatar - - if len(errors) > 0 { - return FriendRequestMultiError(errors) - } - - return nil -} - -// FriendRequestMultiError is an error wrapping multiple validation errors -// returned by FriendRequest.ValidateAll() if the designated constraints -// aren't met. -type FriendRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FriendRequestMultiError) 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 FriendRequestMultiError) AllErrors() []error { return m } - -// FriendRequestValidationError is the validation error returned by -// FriendRequest.Validate if the designated constraints aren't met. -type FriendRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FriendRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FriendRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FriendRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FriendRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FriendRequestValidationError) ErrorName() string { return "FriendRequestValidationError" } - -// Error satisfies the builtin error interface -func (e FriendRequestValidationError) 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 %sFriendRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FriendRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FriendRequestValidationError{} - -// Validate checks the field values on AddFriendRequest 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 *AddFriendRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddFriendRequest 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 -// AddFriendRequestMultiError, or nil if none found. -func (m *AddFriendRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *AddFriendRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetUid()); l < 20 || l > 24 { - err := AddFriendRequestValidationError{ - field: "Uid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if l := utf8.RuneCountInString(m.GetFriendUid()); l < 20 || l > 24 { - err := AddFriendRequestValidationError{ - field: "FriendUid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return AddFriendRequestMultiError(errors) - } - - return nil -} - -// AddFriendRequestMultiError is an error wrapping multiple validation errors -// returned by AddFriendRequest.ValidateAll() if the designated constraints -// aren't met. -type AddFriendRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddFriendRequestMultiError) 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 AddFriendRequestMultiError) AllErrors() []error { return m } - -// AddFriendRequestValidationError is the validation error returned by -// AddFriendRequest.Validate if the designated constraints aren't met. -type AddFriendRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddFriendRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddFriendRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddFriendRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddFriendRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddFriendRequestValidationError) ErrorName() string { return "AddFriendRequestValidationError" } - -// Error satisfies the builtin error interface -func (e AddFriendRequestValidationError) 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 %sAddFriendRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddFriendRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddFriendRequestValidationError{} - -// Validate checks the field values on BaseFriendRequest 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 *BaseFriendRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BaseFriendRequest 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 -// BaseFriendRequestMultiError, or nil if none found. -func (m *BaseFriendRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *BaseFriendRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetUid()); l < 20 || l > 24 { - err := BaseFriendRequestValidationError{ - field: "Uid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if l := utf8.RuneCountInString(m.GetFriendUid()); l < 20 || l > 24 { - err := BaseFriendRequestValidationError{ - field: "FriendUid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return BaseFriendRequestMultiError(errors) - } - - return nil -} - -// BaseFriendRequestMultiError is an error wrapping multiple validation errors -// returned by BaseFriendRequest.ValidateAll() if the designated constraints -// aren't met. -type BaseFriendRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BaseFriendRequestMultiError) 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 BaseFriendRequestMultiError) AllErrors() []error { return m } - -// BaseFriendRequestValidationError is the validation error returned by -// BaseFriendRequest.Validate if the designated constraints aren't met. -type BaseFriendRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BaseFriendRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BaseFriendRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BaseFriendRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BaseFriendRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BaseFriendRequestValidationError) ErrorName() string { - return "BaseFriendRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e BaseFriendRequestValidationError) 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 %sBaseFriendRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BaseFriendRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BaseFriendRequestValidationError{} - -// Validate checks the field values on AddFriendResponse 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 *AddFriendResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddFriendResponse 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 -// AddFriendResponseMultiError, or nil if none found. -func (m *AddFriendResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *AddFriendResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddFriendResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddFriendResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddFriendResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetResult()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddFriendResponseValidationError{ - field: "Result", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddFriendResponseValidationError{ - field: "Result", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddFriendResponseValidationError{ - field: "Result", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return AddFriendResponseMultiError(errors) - } - - return nil -} - -// AddFriendResponseMultiError is an error wrapping multiple validation errors -// returned by AddFriendResponse.ValidateAll() if the designated constraints -// aren't met. -type AddFriendResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddFriendResponseMultiError) 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 AddFriendResponseMultiError) AllErrors() []error { return m } - -// AddFriendResponseValidationError is the validation error returned by -// AddFriendResponse.Validate if the designated constraints aren't met. -type AddFriendResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddFriendResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddFriendResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddFriendResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddFriendResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddFriendResponseValidationError) ErrorName() string { - return "AddFriendResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e AddFriendResponseValidationError) 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 %sAddFriendResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddFriendResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddFriendResponseValidationError{} - -// Validate checks the field values on AddFriendResult 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 *AddFriendResult) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AddFriendResult 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 -// AddFriendResultMultiError, or nil if none found. -func (m *AddFriendResult) ValidateAll() error { - return m.validate(true) -} - -func (m *AddFriendResult) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Status - - if all { - switch v := interface{}(m.GetFriendRequest()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AddFriendResultValidationError{ - field: "FriendRequest", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AddFriendResultValidationError{ - field: "FriendRequest", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFriendRequest()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AddFriendResultValidationError{ - field: "FriendRequest", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return AddFriendResultMultiError(errors) - } - - return nil -} - -// AddFriendResultMultiError is an error wrapping multiple validation errors -// returned by AddFriendResult.ValidateAll() if the designated constraints -// aren't met. -type AddFriendResultMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AddFriendResultMultiError) 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 AddFriendResultMultiError) AllErrors() []error { return m } - -// AddFriendResultValidationError is the validation error returned by -// AddFriendResult.Validate if the designated constraints aren't met. -type AddFriendResultValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AddFriendResultValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AddFriendResultValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AddFriendResultValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AddFriendResultValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AddFriendResultValidationError) ErrorName() string { return "AddFriendResultValidationError" } - -// Error satisfies the builtin error interface -func (e AddFriendResultValidationError) 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 %sAddFriendResult.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AddFriendResultValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AddFriendResultValidationError{} - -// Validate checks the field values on ConfirmFriendRequestReq 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 *ConfirmFriendRequestReq) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ConfirmFriendRequestReq 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 -// ConfirmFriendRequestReqMultiError, or nil if none found. -func (m *ConfirmFriendRequestReq) ValidateAll() error { - return m.validate(true) -} - -func (m *ConfirmFriendRequestReq) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetUid()); l < 20 || l > 24 { - err := ConfirmFriendRequestReqValidationError{ - field: "Uid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetFriendRequestId() <= 0 { - err := ConfirmFriendRequestReqValidationError{ - field: "FriendRequestId", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := ConfirmFriendRequestAction_name[int32(m.GetAction())]; !ok { - err := ConfirmFriendRequestReqValidationError{ - field: "Action", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ConfirmFriendRequestReqMultiError(errors) - } - - return nil -} - -// ConfirmFriendRequestReqMultiError is an error wrapping multiple validation -// errors returned by ConfirmFriendRequestReq.ValidateAll() if the designated -// constraints aren't met. -type ConfirmFriendRequestReqMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ConfirmFriendRequestReqMultiError) 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 ConfirmFriendRequestReqMultiError) AllErrors() []error { return m } - -// ConfirmFriendRequestReqValidationError is the validation error returned by -// ConfirmFriendRequestReq.Validate if the designated constraints aren't met. -type ConfirmFriendRequestReqValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ConfirmFriendRequestReqValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ConfirmFriendRequestReqValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ConfirmFriendRequestReqValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ConfirmFriendRequestReqValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ConfirmFriendRequestReqValidationError) ErrorName() string { - return "ConfirmFriendRequestReqValidationError" -} - -// Error satisfies the builtin error interface -func (e ConfirmFriendRequestReqValidationError) 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 %sConfirmFriendRequestReq.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ConfirmFriendRequestReqValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ConfirmFriendRequestReqValidationError{} - -// Validate checks the field values on GetFriendRequestResponse 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 *GetFriendRequestResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetFriendRequestResponse 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 -// GetFriendRequestResponseMultiError, or nil if none found. -func (m *GetFriendRequestResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetFriendRequestResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetFriendRequestResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetFriendRequestResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetFriendRequestResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetFriendRequest()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetFriendRequestResponseValidationError{ - field: "FriendRequest", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetFriendRequestResponseValidationError{ - field: "FriendRequest", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFriendRequest()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetFriendRequestResponseValidationError{ - field: "FriendRequest", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetFriendRequestResponseMultiError(errors) - } - - return nil -} - -// GetFriendRequestResponseMultiError is an error wrapping multiple validation -// errors returned by GetFriendRequestResponse.ValidateAll() if the designated -// constraints aren't met. -type GetFriendRequestResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetFriendRequestResponseMultiError) 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 GetFriendRequestResponseMultiError) AllErrors() []error { return m } - -// GetFriendRequestResponseValidationError is the validation error returned by -// GetFriendRequestResponse.Validate if the designated constraints aren't met. -type GetFriendRequestResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetFriendRequestResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetFriendRequestResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetFriendRequestResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetFriendRequestResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetFriendRequestResponseValidationError) ErrorName() string { - return "GetFriendRequestResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetFriendRequestResponseValidationError) 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 %sGetFriendRequestResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetFriendRequestResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetFriendRequestResponseValidationError{} - -// Validate checks the field values on QueryFriendRequestListRequest 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 *QueryFriendRequestListRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryFriendRequestListRequest 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 -// QueryFriendRequestListRequestMultiError, or nil if none found. -func (m *QueryFriendRequestListRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryFriendRequestListRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetUid()); l < 20 || l > 24 { - err := QueryFriendRequestListRequestValidationError{ - field: "Uid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return QueryFriendRequestListRequestMultiError(errors) - } - - return nil -} - -// QueryFriendRequestListRequestMultiError is an error wrapping multiple -// validation errors returned by QueryFriendRequestListRequest.ValidateAll() -// if the designated constraints aren't met. -type QueryFriendRequestListRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryFriendRequestListRequestMultiError) 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 QueryFriendRequestListRequestMultiError) AllErrors() []error { return m } - -// QueryFriendRequestListRequestValidationError is the validation error -// returned by QueryFriendRequestListRequest.Validate if the designated -// constraints aren't met. -type QueryFriendRequestListRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryFriendRequestListRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryFriendRequestListRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryFriendRequestListRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryFriendRequestListRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryFriendRequestListRequestValidationError) ErrorName() string { - return "QueryFriendRequestListRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e QueryFriendRequestListRequestValidationError) 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 %sQueryFriendRequestListRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryFriendRequestListRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryFriendRequestListRequestValidationError{} - -// Validate checks the field values on QueryFriendRequestListResponse 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 *QueryFriendRequestListResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryFriendRequestListResponse 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 -// QueryFriendRequestListResponseMultiError, or nil if none found. -func (m *QueryFriendRequestListResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryFriendRequestListResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QueryFriendRequestListResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QueryFriendRequestListResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return QueryFriendRequestListResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetFriendRequestList() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, QueryFriendRequestListResponseValidationError{ - field: fmt.Sprintf("FriendRequestList[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, QueryFriendRequestListResponseValidationError{ - field: fmt.Sprintf("FriendRequestList[%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 QueryFriendRequestListResponseValidationError{ - field: fmt.Sprintf("FriendRequestList[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return QueryFriendRequestListResponseMultiError(errors) - } - - return nil -} - -// QueryFriendRequestListResponseMultiError is an error wrapping multiple -// validation errors returned by QueryFriendRequestListResponse.ValidateAll() -// if the designated constraints aren't met. -type QueryFriendRequestListResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryFriendRequestListResponseMultiError) 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 QueryFriendRequestListResponseMultiError) AllErrors() []error { return m } - -// QueryFriendRequestListResponseValidationError is the validation error -// returned by QueryFriendRequestListResponse.Validate if the designated -// constraints aren't met. -type QueryFriendRequestListResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryFriendRequestListResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryFriendRequestListResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryFriendRequestListResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryFriendRequestListResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryFriendRequestListResponseValidationError) ErrorName() string { - return "QueryFriendRequestListResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e QueryFriendRequestListResponseValidationError) 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 %sQueryFriendRequestListResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryFriendRequestListResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryFriendRequestListResponseValidationError{} diff --git a/api/user/friend/v1/friend.proto b/api/user/friend/v1/friend.proto deleted file mode 100644 index 13c03aa..0000000 --- a/api/user/friend/v1/friend.proto +++ /dev/null @@ -1,142 +0,0 @@ -syntax = "proto3"; - -package api.user.v1; -option go_package = "api/user/friend/v1;v1"; - -import "validate/validate.proto"; - -import "transport/response/response.proto"; - -message Friend { - string uid = 1; - string friend_uid = 2; - string friend_name = 3; - string friend_avatar = 4; - FriendStatus status = 5; - int64 created_at = 6; - int64 updated_at = 7; -} - -enum FriendStatus { - // Friend as default status - FRIEND = 0; - // Stranger when delete friend - STRANGER = 1; - // Blocked when block friend - BLOCKED = 2; - // Unblock when unblock friend - // unblock status won't be in database only use when update friend status - UNBLOCKED = 3; -} - -message UpdateFriendStatusRequest { - BaseFriendRequest info = 1; - FriendStatus status = 2; -} - -message GetFriendResponse { - transport.response.BaseResponse response = 1; - Friend friend = 2; -} - -message QueryFriendListRequest { - string uid = 1 [(validate.rules).string = {min_len: 20, max_len: 24}]; -} - -message QueryFriendListResponse { - transport.response.BaseResponse response = 1; - repeated Friend friend_list = 2; -} - -/* - * FriendRequest -*/ - -// FriendRequest is the request data for adding friend -message FriendRequest { - int64 id = 1; - string uid = 2; - string friend_uid = 3; - FriendRequestStatus status = 4; - int64 created_at = 5; - int64 updated_at = 6; - // friend info for view - string friend_name = 7; - string friend_avatar = 8; -} - -enum FriendRequestStatus { - // Friend request as default status - REQUESTED = 0; - // Friend request as accepted - ACCEPTED = 1; - // Friend request as rejected - REJECTED = 2; -} - -message AddFriendRequest { - string uid = 1 [(validate.rules).string = {min_len: 20, max_len: 24}]; - string friend_uid = 2 [(validate.rules).string = {min_len: 20, max_len: 24}]; -} - -message BaseFriendRequest { - string uid = 1 [(validate.rules).string = {min_len: 20, max_len: 24}]; - string friend_uid = 2 [(validate.rules).string = {min_len: 20, max_len: 24}]; -} - -message AddFriendResponse { - transport.response.BaseResponse response = 1; - AddFriendResult result = 2; -} - -message AddFriendResult { - AddFriendStatus status = 1; - FriendRequest friend_request = 2; -} - -enum AddFriendStatus { - SEND_REQUEST_SUCCESS = 0; - ALREADY_SENT_REQUEST = 1; - ADD_FRIEND_SUCCESS = 2; - BLOCKED_BY_ME = 3; - BLOCKED_BY_FRIEND = 4; -} - -message ConfirmFriendRequestReq { - string uid = 1 [(validate.rules).string = {min_len: 20, max_len: 24}]; - int64 friend_request_id = 2[(validate.rules).int64.gt = 0]; - ConfirmFriendRequestAction action = 3 [(validate.rules).enum.defined_only = true]; -} - -enum ConfirmFriendRequestAction { - ACCEPT = 0; // accept friend request - REJECT = 1; // reject friend request -} - -message GetFriendRequestResponse { - transport.response.BaseResponse response = 1; - FriendRequest friend_request = 2; -} - -message QueryFriendRequestListRequest { - string uid = 1 [(validate.rules).string = {min_len: 20, max_len: 24}]; -} - -message QueryFriendRequestListResponse { - transport.response.BaseResponse response = 1; - repeated FriendRequest friend_request_list = 2; -} - -service FriendService { - // friend request - rpc AddFriend(AddFriendRequest) returns (AddFriendResponse); - rpc ConfirmFriendRequest(ConfirmFriendRequestReq) returns (transport.response.BaseResponse); - rpc GetFriendRequest(BaseFriendRequest) returns (GetFriendRequestResponse); - rpc QueryFriendRequestList(QueryFriendRequestListRequest) returns (QueryFriendRequestListResponse); - - // friend - rpc UpdateFriendStatus(UpdateFriendStatusRequest) returns (transport.response.BaseResponse); - rpc IsFriend(BaseFriendRequest) returns (transport.response.BaseResponse); - rpc GetFriend(BaseFriendRequest) returns (GetFriendResponse); - rpc QueryFriendList(QueryFriendListRequest) returns (QueryFriendListResponse); -} diff --git a/api/user/friend/v1/friend_grpc.pb.go b/api/user/friend/v1/friend_grpc.pb.go deleted file mode 100644 index 7498a45..0000000 --- a/api/user/friend/v1/friend_grpc.pb.go +++ /dev/null @@ -1,358 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -package v1 - -import ( - context "context" - response "github.com/go-goim/core/api/transport/response" - 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 - -// FriendServiceClient is the client API for FriendService 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 FriendServiceClient interface { - // friend request - AddFriend(ctx context.Context, in *AddFriendRequest, opts ...grpc.CallOption) (*AddFriendResponse, error) - ConfirmFriendRequest(ctx context.Context, in *ConfirmFriendRequestReq, opts ...grpc.CallOption) (*response.BaseResponse, error) - GetFriendRequest(ctx context.Context, in *BaseFriendRequest, opts ...grpc.CallOption) (*GetFriendRequestResponse, error) - QueryFriendRequestList(ctx context.Context, in *QueryFriendRequestListRequest, opts ...grpc.CallOption) (*QueryFriendRequestListResponse, error) - // friend - UpdateFriendStatus(ctx context.Context, in *UpdateFriendStatusRequest, opts ...grpc.CallOption) (*response.BaseResponse, error) - IsFriend(ctx context.Context, in *BaseFriendRequest, opts ...grpc.CallOption) (*response.BaseResponse, error) - GetFriend(ctx context.Context, in *BaseFriendRequest, opts ...grpc.CallOption) (*GetFriendResponse, error) - QueryFriendList(ctx context.Context, in *QueryFriendListRequest, opts ...grpc.CallOption) (*QueryFriendListResponse, error) -} - -type friendServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewFriendServiceClient(cc grpc.ClientConnInterface) FriendServiceClient { - return &friendServiceClient{cc} -} - -func (c *friendServiceClient) AddFriend(ctx context.Context, in *AddFriendRequest, opts ...grpc.CallOption) (*AddFriendResponse, error) { - out := new(AddFriendResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/AddFriend", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendServiceClient) ConfirmFriendRequest(ctx context.Context, in *ConfirmFriendRequestReq, opts ...grpc.CallOption) (*response.BaseResponse, error) { - out := new(response.BaseResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/ConfirmFriendRequest", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendServiceClient) GetFriendRequest(ctx context.Context, in *BaseFriendRequest, opts ...grpc.CallOption) (*GetFriendRequestResponse, error) { - out := new(GetFriendRequestResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/GetFriendRequest", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendServiceClient) QueryFriendRequestList(ctx context.Context, in *QueryFriendRequestListRequest, opts ...grpc.CallOption) (*QueryFriendRequestListResponse, error) { - out := new(QueryFriendRequestListResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/QueryFriendRequestList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendServiceClient) UpdateFriendStatus(ctx context.Context, in *UpdateFriendStatusRequest, opts ...grpc.CallOption) (*response.BaseResponse, error) { - out := new(response.BaseResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/UpdateFriendStatus", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendServiceClient) IsFriend(ctx context.Context, in *BaseFriendRequest, opts ...grpc.CallOption) (*response.BaseResponse, error) { - out := new(response.BaseResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/IsFriend", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendServiceClient) GetFriend(ctx context.Context, in *BaseFriendRequest, opts ...grpc.CallOption) (*GetFriendResponse, error) { - out := new(GetFriendResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/GetFriend", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendServiceClient) QueryFriendList(ctx context.Context, in *QueryFriendListRequest, opts ...grpc.CallOption) (*QueryFriendListResponse, error) { - out := new(QueryFriendListResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.FriendService/QueryFriendList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// FriendServiceServer is the server API for FriendService service. -// All implementations must embed UnimplementedFriendServiceServer -// for forward compatibility -type FriendServiceServer interface { - // friend request - AddFriend(context.Context, *AddFriendRequest) (*AddFriendResponse, error) - ConfirmFriendRequest(context.Context, *ConfirmFriendRequestReq) (*response.BaseResponse, error) - GetFriendRequest(context.Context, *BaseFriendRequest) (*GetFriendRequestResponse, error) - QueryFriendRequestList(context.Context, *QueryFriendRequestListRequest) (*QueryFriendRequestListResponse, error) - // friend - UpdateFriendStatus(context.Context, *UpdateFriendStatusRequest) (*response.BaseResponse, error) - IsFriend(context.Context, *BaseFriendRequest) (*response.BaseResponse, error) - GetFriend(context.Context, *BaseFriendRequest) (*GetFriendResponse, error) - QueryFriendList(context.Context, *QueryFriendListRequest) (*QueryFriendListResponse, error) - mustEmbedUnimplementedFriendServiceServer() -} - -// UnimplementedFriendServiceServer must be embedded to have forward compatible implementations. -type UnimplementedFriendServiceServer struct { -} - -func (UnimplementedFriendServiceServer) AddFriend(context.Context, *AddFriendRequest) (*AddFriendResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddFriend not implemented") -} -func (UnimplementedFriendServiceServer) ConfirmFriendRequest(context.Context, *ConfirmFriendRequestReq) (*response.BaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfirmFriendRequest not implemented") -} -func (UnimplementedFriendServiceServer) GetFriendRequest(context.Context, *BaseFriendRequest) (*GetFriendRequestResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFriendRequest not implemented") -} -func (UnimplementedFriendServiceServer) QueryFriendRequestList(context.Context, *QueryFriendRequestListRequest) (*QueryFriendRequestListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryFriendRequestList not implemented") -} -func (UnimplementedFriendServiceServer) UpdateFriendStatus(context.Context, *UpdateFriendStatusRequest) (*response.BaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateFriendStatus not implemented") -} -func (UnimplementedFriendServiceServer) IsFriend(context.Context, *BaseFriendRequest) (*response.BaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsFriend not implemented") -} -func (UnimplementedFriendServiceServer) GetFriend(context.Context, *BaseFriendRequest) (*GetFriendResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFriend not implemented") -} -func (UnimplementedFriendServiceServer) QueryFriendList(context.Context, *QueryFriendListRequest) (*QueryFriendListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryFriendList not implemented") -} -func (UnimplementedFriendServiceServer) mustEmbedUnimplementedFriendServiceServer() {} - -// UnsafeFriendServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to FriendServiceServer will -// result in compilation errors. -type UnsafeFriendServiceServer interface { - mustEmbedUnimplementedFriendServiceServer() -} - -func RegisterFriendServiceServer(s grpc.ServiceRegistrar, srv FriendServiceServer) { - s.RegisterService(&FriendService_ServiceDesc, srv) -} - -func _FriendService_AddFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddFriendRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).AddFriend(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/AddFriend", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).AddFriend(ctx, req.(*AddFriendRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _FriendService_ConfirmFriendRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfirmFriendRequestReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).ConfirmFriendRequest(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/ConfirmFriendRequest", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).ConfirmFriendRequest(ctx, req.(*ConfirmFriendRequestReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _FriendService_GetFriendRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BaseFriendRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).GetFriendRequest(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/GetFriendRequest", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).GetFriendRequest(ctx, req.(*BaseFriendRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _FriendService_QueryFriendRequestList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFriendRequestListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).QueryFriendRequestList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/QueryFriendRequestList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).QueryFriendRequestList(ctx, req.(*QueryFriendRequestListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _FriendService_UpdateFriendStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateFriendStatusRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).UpdateFriendStatus(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/UpdateFriendStatus", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).UpdateFriendStatus(ctx, req.(*UpdateFriendStatusRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _FriendService_IsFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BaseFriendRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).IsFriend(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/IsFriend", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).IsFriend(ctx, req.(*BaseFriendRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _FriendService_GetFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BaseFriendRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).GetFriend(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/GetFriend", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).GetFriend(ctx, req.(*BaseFriendRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _FriendService_QueryFriendList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFriendListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServiceServer).QueryFriendList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.FriendService/QueryFriendList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServiceServer).QueryFriendList(ctx, req.(*QueryFriendListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// FriendService_ServiceDesc is the grpc.ServiceDesc for FriendService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var FriendService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "api.user.v1.FriendService", - HandlerType: (*FriendServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AddFriend", - Handler: _FriendService_AddFriend_Handler, - }, - { - MethodName: "ConfirmFriendRequest", - Handler: _FriendService_ConfirmFriendRequest_Handler, - }, - { - MethodName: "GetFriendRequest", - Handler: _FriendService_GetFriendRequest_Handler, - }, - { - MethodName: "QueryFriendRequestList", - Handler: _FriendService_QueryFriendRequestList_Handler, - }, - { - MethodName: "UpdateFriendStatus", - Handler: _FriendService_UpdateFriendStatus_Handler, - }, - { - MethodName: "IsFriend", - Handler: _FriendService_IsFriend_Handler, - }, - { - MethodName: "GetFriend", - Handler: _FriendService_GetFriend_Handler, - }, - { - MethodName: "QueryFriendList", - Handler: _FriendService_QueryFriendList_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/user/friend/v1/friend.proto", -} diff --git a/api/user/v1/user.ext.go b/api/user/v1/user.ext.go deleted file mode 100644 index f3e81eb..0000000 --- a/api/user/v1/user.ext.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code Written Manually - -package v1 - -func (x *UserInternal) ToUser() *User { - return &User{ - Uid: x.GetUid(), - Name: x.GetName(), - Email: x.GetEmail(), - Phone: x.GetPhone(), - Avatar: x.GetAvatar(), - AgentId: x.AgentId, - LoginStatus: x.GetLoginStatus(), - } -} diff --git a/api/user/v1/user.pb.go b/api/user/v1/user.pb.go deleted file mode 100644 index 23e6aae..0000000 --- a/api/user/v1/user.pb.go +++ /dev/null @@ -1,1177 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.4 -// source: api/user/v1/user.proto - -package v1 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - response "github.com/go-goim/core/api/transport/response" - 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 LoginStatus int32 - -const ( - LoginStatus_LOGIN LoginStatus = 0 - LoginStatus_ALREADY_LOGIN LoginStatus = 1 - LoginStatus_LOGOUT LoginStatus = 2 -) - -// Enum value maps for LoginStatus. -var ( - LoginStatus_name = map[int32]string{ - 0: "LOGIN", - 1: "ALREADY_LOGIN", - 2: "LOGOUT", - } - LoginStatus_value = map[string]int32{ - "LOGIN": 0, - "ALREADY_LOGIN": 1, - "LOGOUT": 2, - } -) - -func (x LoginStatus) Enum() *LoginStatus { - p := new(LoginStatus) - *p = x - return p -} - -func (x LoginStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (LoginStatus) Descriptor() protoreflect.EnumDescriptor { - return file_api_user_v1_user_proto_enumTypes[0].Descriptor() -} - -func (LoginStatus) Type() protoreflect.EnumType { - return &file_api_user_v1_user_proto_enumTypes[0] -} - -func (x LoginStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use LoginStatus.Descriptor instead. -func (LoginStatus) EnumDescriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{0} -} - -type LoginType int32 - -const ( - LoginType_LOGIN_TYPE_TRY LoginType = 0 - LoginType_LOGIN_TYPE_FORCE LoginType = 1 -) - -// Enum value maps for LoginType. -var ( - LoginType_name = map[int32]string{ - 0: "LOGIN_TYPE_TRY", - 1: "LOGIN_TYPE_FORCE", - } - LoginType_value = map[string]int32{ - "LOGIN_TYPE_TRY": 0, - "LOGIN_TYPE_FORCE": 1, - } -) - -func (x LoginType) Enum() *LoginType { - p := new(LoginType) - *p = x - return p -} - -func (x LoginType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (LoginType) Descriptor() protoreflect.EnumDescriptor { - return file_api_user_v1_user_proto_enumTypes[1].Descriptor() -} - -func (LoginType) Type() protoreflect.EnumType { - return &file_api_user_v1_user_proto_enumTypes[1] -} - -func (x LoginType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use LoginType.Descriptor instead. -func (LoginType) EnumDescriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{1} -} - -type UserInternalResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Response *response.BaseResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - User *UserInternal `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` -} - -func (x *UserInternalResponse) Reset() { - *x = UserInternalResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UserInternalResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserInternalResponse) ProtoMessage() {} - -func (x *UserInternalResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 UserInternalResponse.ProtoReflect.Descriptor instead. -func (*UserInternalResponse) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{0} -} - -func (x *UserInternalResponse) GetResponse() *response.BaseResponse { - if x != nil { - return x.Response - } - return nil -} - -func (x *UserInternalResponse) GetUser() *UserInternal { - if x != nil { - return x.User - } - return nil -} - -// UserInternal is the internal representation of a user. -type UserInternal struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Email *string `protobuf:"bytes,3,opt,name=email,proto3,oneof" json:"email,omitempty"` - Phone *string `protobuf:"bytes,4,opt,name=phone,proto3,oneof" json:"phone,omitempty"` - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` - // AgentID only valid when user already login. - AgentId *string `protobuf:"bytes,6,opt,name=agent_id,json=agentId,proto3,oneof" json:"agent_id,omitempty"` - Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"` - // 0: first time login, need connect to push server - // 1: already login, no need connect to push server - LoginStatus LoginStatus `protobuf:"varint,8,opt,name=login_status,json=loginStatus,proto3,enum=api.user.v1.LoginStatus" json:"login_status,omitempty"` - CreatedAt int64 `protobuf:"varint,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - UpdatedAt int64 `protobuf:"varint,10,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` -} - -func (x *UserInternal) Reset() { - *x = UserInternal{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UserInternal) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserInternal) ProtoMessage() {} - -func (x *UserInternal) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 UserInternal.ProtoReflect.Descriptor instead. -func (*UserInternal) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{1} -} - -func (x *UserInternal) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *UserInternal) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UserInternal) GetEmail() string { - if x != nil && x.Email != nil { - return *x.Email - } - return "" -} - -func (x *UserInternal) GetPhone() string { - if x != nil && x.Phone != nil { - return *x.Phone - } - return "" -} - -func (x *UserInternal) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *UserInternal) GetAgentId() string { - if x != nil && x.AgentId != nil { - return *x.AgentId - } - return "" -} - -func (x *UserInternal) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *UserInternal) GetLoginStatus() LoginStatus { - if x != nil { - return x.LoginStatus - } - return LoginStatus_LOGIN -} - -func (x *UserInternal) GetCreatedAt() int64 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *UserInternal) GetUpdatedAt() int64 { - if x != nil { - return x.UpdatedAt - } - return 0 -} - -// User use for return user info to client. -type User struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` - // AgentID only valid when user already login. - AgentId *string `protobuf:"bytes,6,opt,name=agent_id,json=agentId,proto3,oneof" json:"agent_id,omitempty"` - // 0: first time login, need connect to push server - // 1: already login, no need connect to push server - LoginStatus LoginStatus `protobuf:"varint,8,opt,name=login_status,json=loginStatus,proto3,enum=api.user.v1.LoginStatus" json:"login_status,omitempty"` -} - -func (x *User) Reset() { - *x = User{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *User) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*User) ProtoMessage() {} - -func (x *User) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 User.ProtoReflect.Descriptor instead. -func (*User) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{2} -} - -func (x *User) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *User) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *User) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *User) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *User) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *User) GetAgentId() string { - if x != nil && x.AgentId != nil { - return *x.AgentId - } - return "" -} - -func (x *User) GetLoginStatus() LoginStatus { - if x != nil { - return x.LoginStatus - } - return LoginStatus_LOGIN -} - -type UserList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` -} - -func (x *UserList) Reset() { - *x = UserList{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UserList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserList) ProtoMessage() {} - -func (x *UserList) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 UserList.ProtoReflect.Descriptor instead. -func (*UserList) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{3} -} - -func (x *UserList) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -type GetUserInfoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` -} - -func (x *GetUserInfoRequest) Reset() { - *x = GetUserInfoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUserInfoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserInfoRequest) ProtoMessage() {} - -func (x *GetUserInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 GetUserInfoRequest.ProtoReflect.Descriptor instead. -func (*GetUserInfoRequest) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{4} -} - -func (x *GetUserInfoRequest) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -type QueryUserRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to User: - // *QueryUserRequest_Email - // *QueryUserRequest_Phone - User isQueryUserRequest_User `protobuf_oneof:"user"` -} - -func (x *QueryUserRequest) Reset() { - *x = QueryUserRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryUserRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryUserRequest) ProtoMessage() {} - -func (x *QueryUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 QueryUserRequest.ProtoReflect.Descriptor instead. -func (*QueryUserRequest) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{5} -} - -func (m *QueryUserRequest) GetUser() isQueryUserRequest_User { - if m != nil { - return m.User - } - return nil -} - -func (x *QueryUserRequest) GetEmail() string { - if x, ok := x.GetUser().(*QueryUserRequest_Email); ok { - return x.Email - } - return "" -} - -func (x *QueryUserRequest) GetPhone() string { - if x, ok := x.GetUser().(*QueryUserRequest_Phone); ok { - return x.Phone - } - return "" -} - -type isQueryUserRequest_User interface { - isQueryUserRequest_User() -} - -type QueryUserRequest_Email struct { - Email string `protobuf:"bytes,1,opt,name=email,proto3,oneof"` -} - -type QueryUserRequest_Phone struct { - Phone string `protobuf:"bytes,2,opt,name=phone,proto3,oneof"` -} - -func (*QueryUserRequest_Email) isQueryUserRequest_User() {} - -func (*QueryUserRequest_Phone) isQueryUserRequest_User() {} - -type CreateUserRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are assignable to User: - // *CreateUserRequest_Email - // *CreateUserRequest_Phone - User isCreateUserRequest_User `protobuf_oneof:"user"` - Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` -} - -func (x *CreateUserRequest) Reset() { - *x = CreateUserRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateUserRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateUserRequest) ProtoMessage() {} - -func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 CreateUserRequest.ProtoReflect.Descriptor instead. -func (*CreateUserRequest) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{6} -} - -func (x *CreateUserRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (m *CreateUserRequest) GetUser() isCreateUserRequest_User { - if m != nil { - return m.User - } - return nil -} - -func (x *CreateUserRequest) GetEmail() string { - if x, ok := x.GetUser().(*CreateUserRequest_Email); ok { - return x.Email - } - return "" -} - -func (x *CreateUserRequest) GetPhone() string { - if x, ok := x.GetUser().(*CreateUserRequest_Phone); ok { - return x.Phone - } - return "" -} - -func (x *CreateUserRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -type isCreateUserRequest_User interface { - isCreateUserRequest_User() -} - -type CreateUserRequest_Email struct { - Email string `protobuf:"bytes,2,opt,name=email,proto3,oneof"` -} - -type CreateUserRequest_Phone struct { - Phone string `protobuf:"bytes,3,opt,name=phone,proto3,oneof"` -} - -func (*CreateUserRequest_Email) isCreateUserRequest_User() {} - -func (*CreateUserRequest_Phone) isCreateUserRequest_User() {} - -type UpdateUserRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` -} - -func (x *UpdateUserRequest) Reset() { - *x = UpdateUserRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateUserRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserRequest) ProtoMessage() {} - -func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 UpdateUserRequest.ProtoReflect.Descriptor instead. -func (*UpdateUserRequest) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{7} -} - -func (x *UpdateUserRequest) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *UpdateUserRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpdateUserRequest) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *UpdateUserRequest) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *UpdateUserRequest) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -type UserLoginRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to User: - // *UserLoginRequest_Email - // *UserLoginRequest_Phone - User isUserLoginRequest_User `protobuf_oneof:"user"` - Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` - // 0: try login , do nothing if already login - // 1: force login , logout if already login - LoginType LoginType `protobuf:"varint,4,opt,name=login_type,json=loginType,proto3,enum=api.user.v1.LoginType" json:"login_type,omitempty"` -} - -func (x *UserLoginRequest) Reset() { - *x = UserLoginRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_user_v1_user_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UserLoginRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserLoginRequest) ProtoMessage() {} - -func (x *UserLoginRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_user_v1_user_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 UserLoginRequest.ProtoReflect.Descriptor instead. -func (*UserLoginRequest) Descriptor() ([]byte, []int) { - return file_api_user_v1_user_proto_rawDescGZIP(), []int{8} -} - -func (m *UserLoginRequest) GetUser() isUserLoginRequest_User { - if m != nil { - return m.User - } - return nil -} - -func (x *UserLoginRequest) GetEmail() string { - if x, ok := x.GetUser().(*UserLoginRequest_Email); ok { - return x.Email - } - return "" -} - -func (x *UserLoginRequest) GetPhone() string { - if x, ok := x.GetUser().(*UserLoginRequest_Phone); ok { - return x.Phone - } - return "" -} - -func (x *UserLoginRequest) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -func (x *UserLoginRequest) GetLoginType() LoginType { - if x != nil { - return x.LoginType - } - return LoginType_LOGIN_TYPE_TRY -} - -type isUserLoginRequest_User interface { - isUserLoginRequest_User() -} - -type UserLoginRequest_Email struct { - Email string `protobuf:"bytes,1,opt,name=email,proto3,oneof"` -} - -type UserLoginRequest_Phone struct { - Phone string `protobuf:"bytes,2,opt,name=phone,proto3,oneof"` -} - -func (*UserLoginRequest_Email) isUserLoginRequest_User() {} - -func (*UserLoginRequest_Phone) isUserLoginRequest_User() {} - -var File_api_user_v1_user_proto protoreflect.FileDescriptor - -var file_api_user_v1_user_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, - 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, - 0x65, 0x72, 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, 0x1a, 0x21, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x87, 0x01, 0x0a, 0x14, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x04, - 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0xda, 0x02, 0x0a, 0x0c, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x10, 0x0a, 0x03, - 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, - 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, - 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, - 0x12, 0x1e, 0x0a, 0x08, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x02, 0x52, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x3b, 0x0a, 0x0c, - 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, - 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0b, 0x6c, 0x6f, - 0x67, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 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, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x6d, 0x61, 0x69, - 0x6c, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0xda, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, - 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, - 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, - 0x6f, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1e, 0x0a, 0x08, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x3b, 0x0a, 0x0c, 0x6c, - 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, - 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0b, 0x6c, 0x6f, 0x67, - 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x61, 0x67, 0x65, - 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x33, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, - 0x74, 0x12, 0x27, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x31, 0x0a, 0x12, 0x47, 0x65, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1b, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xfa, - 0x42, 0x06, 0x72, 0x04, 0x10, 0x14, 0x18, 0x18, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x6e, 0x0a, - 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x1f, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x60, 0x01, 0x48, 0x00, 0x52, 0x05, 0x65, 0x6d, 0x61, - 0x69, 0x6c, 0x12, 0x2c, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x14, 0xfa, 0x42, 0x11, 0x72, 0x0f, 0x32, 0x0d, 0x5e, 0x31, 0x5b, 0x33, 0x2d, 0x39, - 0x5d, 0x5c, 0x64, 0x7b, 0x39, 0x7d, 0x24, 0x48, 0x00, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, - 0x42, 0x0b, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xb5, 0x01, - 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x02, 0x18, 0x14, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x60, 0x01, 0x48, 0x00, 0x52, 0x05, 0x65, 0x6d, - 0x61, 0x69, 0x6c, 0x12, 0x2c, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x14, 0xfa, 0x42, 0x11, 0x72, 0x0f, 0x32, 0x0d, 0x5e, 0x31, 0x5b, 0x33, 0x2d, - 0x39, 0x5d, 0x5c, 0x64, 0x7b, 0x39, 0x7d, 0x24, 0x48, 0x00, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, - 0x65, 0x12, 0x25, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, 0x06, 0x18, 0x14, 0x52, 0x08, - 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x0b, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, - 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0xc8, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x75, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x72, 0x04, 0x10, - 0x14, 0x18, 0x18, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x72, 0x07, 0x10, 0x02, 0x18, - 0x14, 0xd0, 0x01, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x05, 0x65, 0x6d, - 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, - 0x60, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2d, 0x0a, 0x05, - 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xfa, 0x42, 0x14, - 0x72, 0x12, 0x32, 0x0d, 0x5e, 0x31, 0x5b, 0x33, 0x2d, 0x39, 0x5d, 0x5c, 0x64, 0x7b, 0x39, 0x7d, - 0x24, 0xd0, 0x01, 0x01, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x23, 0x0a, 0x06, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, 0x08, - 0x72, 0x06, 0x18, 0x80, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, - 0x22, 0xc1, 0x01, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x60, 0x01, 0x48, 0x00, 0x52, - 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x2c, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x14, 0xfa, 0x42, 0x11, 0x72, 0x0f, 0x32, 0x0d, 0x5e, 0x31, - 0x5b, 0x33, 0x2d, 0x39, 0x5d, 0x5c, 0x64, 0x7b, 0x39, 0x7d, 0x24, 0x48, 0x00, 0x52, 0x05, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x12, 0x35, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, - 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6c, 0x6f, - 0x67, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0b, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, - 0x03, 0xf8, 0x42, 0x01, 0x2a, 0x37, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x4f, 0x47, 0x49, 0x4e, 0x10, 0x00, 0x12, 0x11, - 0x0a, 0x0d, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x4e, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x47, 0x4f, 0x55, 0x54, 0x10, 0x02, 0x2a, 0x35, 0x0a, - 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, - 0x47, 0x49, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x59, 0x10, 0x00, 0x12, 0x14, - 0x0a, 0x10, 0x4c, 0x4f, 0x47, 0x49, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4f, 0x52, - 0x43, 0x45, 0x10, 0x01, 0x32, 0xcd, 0x02, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, - 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, - 0x12, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, - 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, - 0x72, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10, 0x5a, 0x0e, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, - 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_user_v1_user_proto_rawDescOnce sync.Once - file_api_user_v1_user_proto_rawDescData = file_api_user_v1_user_proto_rawDesc -) - -func file_api_user_v1_user_proto_rawDescGZIP() []byte { - file_api_user_v1_user_proto_rawDescOnce.Do(func() { - file_api_user_v1_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_user_v1_user_proto_rawDescData) - }) - return file_api_user_v1_user_proto_rawDescData -} - -var file_api_user_v1_user_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_user_v1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_api_user_v1_user_proto_goTypes = []interface{}{ - (LoginStatus)(0), // 0: api.user.v1.LoginStatus - (LoginType)(0), // 1: api.user.v1.LoginType - (*UserInternalResponse)(nil), // 2: api.user.v1.UserInternalResponse - (*UserInternal)(nil), // 3: api.user.v1.UserInternal - (*User)(nil), // 4: api.user.v1.User - (*UserList)(nil), // 5: api.user.v1.UserList - (*GetUserInfoRequest)(nil), // 6: api.user.v1.GetUserInfoRequest - (*QueryUserRequest)(nil), // 7: api.user.v1.QueryUserRequest - (*CreateUserRequest)(nil), // 8: api.user.v1.CreateUserRequest - (*UpdateUserRequest)(nil), // 9: api.user.v1.UpdateUserRequest - (*UserLoginRequest)(nil), // 10: api.user.v1.UserLoginRequest - (*response.BaseResponse)(nil), // 11: api.transport.response.BaseResponse -} -var file_api_user_v1_user_proto_depIdxs = []int32{ - 11, // 0: api.user.v1.UserInternalResponse.response:type_name -> api.transport.response.BaseResponse - 3, // 1: api.user.v1.UserInternalResponse.user:type_name -> api.user.v1.UserInternal - 0, // 2: api.user.v1.UserInternal.login_status:type_name -> api.user.v1.LoginStatus - 0, // 3: api.user.v1.User.login_status:type_name -> api.user.v1.LoginStatus - 4, // 4: api.user.v1.UserList.users:type_name -> api.user.v1.User - 1, // 5: api.user.v1.UserLoginRequest.login_type:type_name -> api.user.v1.LoginType - 6, // 6: api.user.v1.UserService.GetUser:input_type -> api.user.v1.GetUserInfoRequest - 7, // 7: api.user.v1.UserService.QueryUser:input_type -> api.user.v1.QueryUserRequest - 8, // 8: api.user.v1.UserService.CreateUser:input_type -> api.user.v1.CreateUserRequest - 9, // 9: api.user.v1.UserService.UpdateUser:input_type -> api.user.v1.UpdateUserRequest - 2, // 10: api.user.v1.UserService.GetUser:output_type -> api.user.v1.UserInternalResponse - 2, // 11: api.user.v1.UserService.QueryUser:output_type -> api.user.v1.UserInternalResponse - 2, // 12: api.user.v1.UserService.CreateUser:output_type -> api.user.v1.UserInternalResponse - 2, // 13: api.user.v1.UserService.UpdateUser:output_type -> api.user.v1.UserInternalResponse - 10, // [10:14] is the sub-list for method output_type - 6, // [6:10] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_api_user_v1_user_proto_init() } -func file_api_user_v1_user_proto_init() { - if File_api_user_v1_user_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_user_v1_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserInternalResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserInternal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*User); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUserInfoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryUserRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateUserRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateUserRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_user_v1_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserLoginRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_api_user_v1_user_proto_msgTypes[1].OneofWrappers = []interface{}{} - file_api_user_v1_user_proto_msgTypes[2].OneofWrappers = []interface{}{} - file_api_user_v1_user_proto_msgTypes[5].OneofWrappers = []interface{}{ - (*QueryUserRequest_Email)(nil), - (*QueryUserRequest_Phone)(nil), - } - file_api_user_v1_user_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*CreateUserRequest_Email)(nil), - (*CreateUserRequest_Phone)(nil), - } - file_api_user_v1_user_proto_msgTypes[8].OneofWrappers = []interface{}{ - (*UserLoginRequest_Email)(nil), - (*UserLoginRequest_Phone)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_user_v1_user_proto_rawDesc, - NumEnums: 2, - NumMessages: 9, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_api_user_v1_user_proto_goTypes, - DependencyIndexes: file_api_user_v1_user_proto_depIdxs, - EnumInfos: file_api_user_v1_user_proto_enumTypes, - MessageInfos: file_api_user_v1_user_proto_msgTypes, - }.Build() - File_api_user_v1_user_proto = out.File - file_api_user_v1_user_proto_rawDesc = nil - file_api_user_v1_user_proto_goTypes = nil - file_api_user_v1_user_proto_depIdxs = nil -} diff --git a/api/user/v1/user.pb.validate.go b/api/user/v1/user.pb.validate.go deleted file mode 100644 index e69a411..0000000 --- a/api/user/v1/user.pb.validate.go +++ /dev/null @@ -1,1514 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: api/user/v1/user.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 UserInternalResponse 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 *UserInternalResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UserInternalResponse 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 -// UserInternalResponseMultiError, or nil if none found. -func (m *UserInternalResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UserInternalResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UserInternalResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UserInternalResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UserInternalResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetUser()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UserInternalResponseValidationError{ - field: "User", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UserInternalResponseValidationError{ - field: "User", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UserInternalResponseValidationError{ - field: "User", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return UserInternalResponseMultiError(errors) - } - - return nil -} - -// UserInternalResponseMultiError is an error wrapping multiple validation -// errors returned by UserInternalResponse.ValidateAll() if the designated -// constraints aren't met. -type UserInternalResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UserInternalResponseMultiError) 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 UserInternalResponseMultiError) AllErrors() []error { return m } - -// UserInternalResponseValidationError is the validation error returned by -// UserInternalResponse.Validate if the designated constraints aren't met. -type UserInternalResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UserInternalResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UserInternalResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UserInternalResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UserInternalResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UserInternalResponseValidationError) ErrorName() string { - return "UserInternalResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UserInternalResponseValidationError) 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 %sUserInternalResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UserInternalResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UserInternalResponseValidationError{} - -// Validate checks the field values on UserInternal 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 *UserInternal) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UserInternal 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 UserInternalMultiError, or -// nil if none found. -func (m *UserInternal) ValidateAll() error { - return m.validate(true) -} - -func (m *UserInternal) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Uid - - // no validation rules for Name - - // no validation rules for Avatar - - // no validation rules for Password - - // no validation rules for LoginStatus - - // no validation rules for CreatedAt - - // no validation rules for UpdatedAt - - if m.Email != nil { - // no validation rules for Email - } - - if m.Phone != nil { - // no validation rules for Phone - } - - if m.AgentId != nil { - // no validation rules for AgentId - } - - if len(errors) > 0 { - return UserInternalMultiError(errors) - } - - return nil -} - -// UserInternalMultiError is an error wrapping multiple validation errors -// returned by UserInternal.ValidateAll() if the designated constraints aren't met. -type UserInternalMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UserInternalMultiError) 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 UserInternalMultiError) AllErrors() []error { return m } - -// UserInternalValidationError is the validation error returned by -// UserInternal.Validate if the designated constraints aren't met. -type UserInternalValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UserInternalValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UserInternalValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UserInternalValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UserInternalValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UserInternalValidationError) ErrorName() string { return "UserInternalValidationError" } - -// Error satisfies the builtin error interface -func (e UserInternalValidationError) 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 %sUserInternal.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UserInternalValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UserInternalValidationError{} - -// Validate checks the field values on User 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 *User) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on User 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 UserMultiError, or nil if none found. -func (m *User) ValidateAll() error { - return m.validate(true) -} - -func (m *User) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Uid - - // no validation rules for Name - - // no validation rules for Email - - // no validation rules for Phone - - // no validation rules for Avatar - - // no validation rules for LoginStatus - - if m.AgentId != nil { - // no validation rules for AgentId - } - - if len(errors) > 0 { - return UserMultiError(errors) - } - - return nil -} - -// UserMultiError is an error wrapping multiple validation errors returned by -// User.ValidateAll() if the designated constraints aren't met. -type UserMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UserMultiError) 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 UserMultiError) AllErrors() []error { return m } - -// UserValidationError is the validation error returned by User.Validate if the -// designated constraints aren't met. -type UserValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UserValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UserValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UserValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UserValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UserValidationError) ErrorName() string { return "UserValidationError" } - -// Error satisfies the builtin error interface -func (e UserValidationError) 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 %sUser.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UserValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UserValidationError{} - -// Validate checks the field values on UserList 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 *UserList) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UserList 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 UserListMultiError, or nil -// if none found. -func (m *UserList) ValidateAll() error { - return m.validate(true) -} - -func (m *UserList) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetUsers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UserListValidationError{ - field: fmt.Sprintf("Users[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UserListValidationError{ - field: fmt.Sprintf("Users[%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 UserListValidationError{ - field: fmt.Sprintf("Users[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return UserListMultiError(errors) - } - - return nil -} - -// UserListMultiError is an error wrapping multiple validation errors returned -// by UserList.ValidateAll() if the designated constraints aren't met. -type UserListMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UserListMultiError) 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 UserListMultiError) AllErrors() []error { return m } - -// UserListValidationError is the validation error returned by -// UserList.Validate if the designated constraints aren't met. -type UserListValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UserListValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UserListValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UserListValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UserListValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UserListValidationError) ErrorName() string { return "UserListValidationError" } - -// Error satisfies the builtin error interface -func (e UserListValidationError) 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 %sUserList.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UserListValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UserListValidationError{} - -// Validate checks the field values on GetUserInfoRequest 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 *GetUserInfoRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetUserInfoRequest 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 -// GetUserInfoRequestMultiError, or nil if none found. -func (m *GetUserInfoRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetUserInfoRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetUid()); l < 20 || l > 24 { - err := GetUserInfoRequestValidationError{ - field: "Uid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return GetUserInfoRequestMultiError(errors) - } - - return nil -} - -// GetUserInfoRequestMultiError is an error wrapping multiple validation errors -// returned by GetUserInfoRequest.ValidateAll() if the designated constraints -// aren't met. -type GetUserInfoRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetUserInfoRequestMultiError) 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 GetUserInfoRequestMultiError) AllErrors() []error { return m } - -// GetUserInfoRequestValidationError is the validation error returned by -// GetUserInfoRequest.Validate if the designated constraints aren't met. -type GetUserInfoRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetUserInfoRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetUserInfoRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetUserInfoRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetUserInfoRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetUserInfoRequestValidationError) ErrorName() string { - return "GetUserInfoRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetUserInfoRequestValidationError) 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 %sGetUserInfoRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetUserInfoRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetUserInfoRequestValidationError{} - -// Validate checks the field values on QueryUserRequest 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 *QueryUserRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on QueryUserRequest 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 -// QueryUserRequestMultiError, or nil if none found. -func (m *QueryUserRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *QueryUserRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch m.User.(type) { - - case *QueryUserRequest_Email: - - if err := m._validateEmail(m.GetEmail()); err != nil { - err = QueryUserRequestValidationError{ - field: "Email", - reason: "value must be a valid email address", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } - - case *QueryUserRequest_Phone: - - if !_QueryUserRequest_Phone_Pattern.MatchString(m.GetPhone()) { - err := QueryUserRequestValidationError{ - field: "Phone", - reason: "value does not match regex pattern \"^1[3-9]\\\\d{9}$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - err := QueryUserRequestValidationError{ - field: "User", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - - } - - if len(errors) > 0 { - return QueryUserRequestMultiError(errors) - } - - return nil -} - -func (m *QueryUserRequest) _validateHostname(host string) error { - s := strings.ToLower(strings.TrimSuffix(host, ".")) - - if len(host) > 253 { - return errors.New("hostname cannot exceed 253 characters") - } - - for _, part := range strings.Split(s, ".") { - if l := len(part); l == 0 || l > 63 { - return errors.New("hostname part must be non-empty and cannot exceed 63 characters") - } - - if part[0] == '-' { - return errors.New("hostname parts cannot begin with hyphens") - } - - if part[len(part)-1] == '-' { - return errors.New("hostname parts cannot end with hyphens") - } - - for _, r := range part { - if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { - return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) - } - } - } - - return nil -} - -func (m *QueryUserRequest) _validateEmail(addr string) error { - a, err := mail.ParseAddress(addr) - if err != nil { - return err - } - addr = a.Address - - if len(addr) > 254 { - return errors.New("email addresses cannot exceed 254 characters") - } - - parts := strings.SplitN(addr, "@", 2) - - if len(parts[0]) > 64 { - return errors.New("email address local phrase cannot exceed 64 characters") - } - - return m._validateHostname(parts[1]) -} - -// QueryUserRequestMultiError is an error wrapping multiple validation errors -// returned by QueryUserRequest.ValidateAll() if the designated constraints -// aren't met. -type QueryUserRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m QueryUserRequestMultiError) 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 QueryUserRequestMultiError) AllErrors() []error { return m } - -// QueryUserRequestValidationError is the validation error returned by -// QueryUserRequest.Validate if the designated constraints aren't met. -type QueryUserRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e QueryUserRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e QueryUserRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e QueryUserRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e QueryUserRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e QueryUserRequestValidationError) ErrorName() string { return "QueryUserRequestValidationError" } - -// Error satisfies the builtin error interface -func (e QueryUserRequestValidationError) 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 %sQueryUserRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = QueryUserRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = QueryUserRequestValidationError{} - -var _QueryUserRequest_Phone_Pattern = regexp.MustCompile("^1[3-9]\\d{9}$") - -// Validate checks the field values on CreateUserRequest 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 *CreateUserRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CreateUserRequest 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 -// CreateUserRequestMultiError, or nil if none found. -func (m *CreateUserRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *CreateUserRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetName()); l < 2 || l > 20 { - err := CreateUserRequestValidationError{ - field: "Name", - reason: "value length must be between 2 and 20 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if l := utf8.RuneCountInString(m.GetPassword()); l < 6 || l > 20 { - err := CreateUserRequestValidationError{ - field: "Password", - reason: "value length must be between 6 and 20 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - switch m.User.(type) { - - case *CreateUserRequest_Email: - - if err := m._validateEmail(m.GetEmail()); err != nil { - err = CreateUserRequestValidationError{ - field: "Email", - reason: "value must be a valid email address", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } - - case *CreateUserRequest_Phone: - - if !_CreateUserRequest_Phone_Pattern.MatchString(m.GetPhone()) { - err := CreateUserRequestValidationError{ - field: "Phone", - reason: "value does not match regex pattern \"^1[3-9]\\\\d{9}$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - err := CreateUserRequestValidationError{ - field: "User", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - - } - - if len(errors) > 0 { - return CreateUserRequestMultiError(errors) - } - - return nil -} - -func (m *CreateUserRequest) _validateHostname(host string) error { - s := strings.ToLower(strings.TrimSuffix(host, ".")) - - if len(host) > 253 { - return errors.New("hostname cannot exceed 253 characters") - } - - for _, part := range strings.Split(s, ".") { - if l := len(part); l == 0 || l > 63 { - return errors.New("hostname part must be non-empty and cannot exceed 63 characters") - } - - if part[0] == '-' { - return errors.New("hostname parts cannot begin with hyphens") - } - - if part[len(part)-1] == '-' { - return errors.New("hostname parts cannot end with hyphens") - } - - for _, r := range part { - if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { - return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) - } - } - } - - return nil -} - -func (m *CreateUserRequest) _validateEmail(addr string) error { - a, err := mail.ParseAddress(addr) - if err != nil { - return err - } - addr = a.Address - - if len(addr) > 254 { - return errors.New("email addresses cannot exceed 254 characters") - } - - parts := strings.SplitN(addr, "@", 2) - - if len(parts[0]) > 64 { - return errors.New("email address local phrase cannot exceed 64 characters") - } - - return m._validateHostname(parts[1]) -} - -// CreateUserRequestMultiError is an error wrapping multiple validation errors -// returned by CreateUserRequest.ValidateAll() if the designated constraints -// aren't met. -type CreateUserRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CreateUserRequestMultiError) 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 CreateUserRequestMultiError) AllErrors() []error { return m } - -// CreateUserRequestValidationError is the validation error returned by -// CreateUserRequest.Validate if the designated constraints aren't met. -type CreateUserRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CreateUserRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CreateUserRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CreateUserRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CreateUserRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CreateUserRequestValidationError) ErrorName() string { - return "CreateUserRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e CreateUserRequestValidationError) 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 %sCreateUserRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CreateUserRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CreateUserRequestValidationError{} - -var _CreateUserRequest_Phone_Pattern = regexp.MustCompile("^1[3-9]\\d{9}$") - -// Validate checks the field values on UpdateUserRequest 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 *UpdateUserRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateUserRequest 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 -// UpdateUserRequestMultiError, or nil if none found. -func (m *UpdateUserRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateUserRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if l := utf8.RuneCountInString(m.GetUid()); l < 20 || l > 24 { - err := UpdateUserRequestValidationError{ - field: "Uid", - reason: "value length must be between 20 and 24 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetName() != "" { - - if l := utf8.RuneCountInString(m.GetName()); l < 2 || l > 20 { - err := UpdateUserRequestValidationError{ - field: "Name", - reason: "value length must be between 2 and 20 runes, inclusive", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if m.GetEmail() != "" { - - if err := m._validateEmail(m.GetEmail()); err != nil { - err = UpdateUserRequestValidationError{ - field: "Email", - reason: "value must be a valid email address", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if m.GetPhone() != "" { - - if !_UpdateUserRequest_Phone_Pattern.MatchString(m.GetPhone()) { - err := UpdateUserRequestValidationError{ - field: "Phone", - reason: "value does not match regex pattern \"^1[3-9]\\\\d{9}$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if m.GetAvatar() != "" { - - if utf8.RuneCountInString(m.GetAvatar()) > 128 { - err := UpdateUserRequestValidationError{ - field: "Avatar", - reason: "value length must be at most 128 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if len(errors) > 0 { - return UpdateUserRequestMultiError(errors) - } - - return nil -} - -func (m *UpdateUserRequest) _validateHostname(host string) error { - s := strings.ToLower(strings.TrimSuffix(host, ".")) - - if len(host) > 253 { - return errors.New("hostname cannot exceed 253 characters") - } - - for _, part := range strings.Split(s, ".") { - if l := len(part); l == 0 || l > 63 { - return errors.New("hostname part must be non-empty and cannot exceed 63 characters") - } - - if part[0] == '-' { - return errors.New("hostname parts cannot begin with hyphens") - } - - if part[len(part)-1] == '-' { - return errors.New("hostname parts cannot end with hyphens") - } - - for _, r := range part { - if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { - return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) - } - } - } - - return nil -} - -func (m *UpdateUserRequest) _validateEmail(addr string) error { - a, err := mail.ParseAddress(addr) - if err != nil { - return err - } - addr = a.Address - - if len(addr) > 254 { - return errors.New("email addresses cannot exceed 254 characters") - } - - parts := strings.SplitN(addr, "@", 2) - - if len(parts[0]) > 64 { - return errors.New("email address local phrase cannot exceed 64 characters") - } - - return m._validateHostname(parts[1]) -} - -// UpdateUserRequestMultiError is an error wrapping multiple validation errors -// returned by UpdateUserRequest.ValidateAll() if the designated constraints -// aren't met. -type UpdateUserRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateUserRequestMultiError) 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 UpdateUserRequestMultiError) AllErrors() []error { return m } - -// UpdateUserRequestValidationError is the validation error returned by -// UpdateUserRequest.Validate if the designated constraints aren't met. -type UpdateUserRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateUserRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateUserRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateUserRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateUserRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateUserRequestValidationError) ErrorName() string { - return "UpdateUserRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateUserRequestValidationError) 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 %sUpdateUserRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateUserRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateUserRequestValidationError{} - -var _UpdateUserRequest_Phone_Pattern = regexp.MustCompile("^1[3-9]\\d{9}$") - -// Validate checks the field values on UserLoginRequest 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 *UserLoginRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UserLoginRequest 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 -// UserLoginRequestMultiError, or nil if none found. -func (m *UserLoginRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *UserLoginRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Password - - // no validation rules for LoginType - - switch m.User.(type) { - - case *UserLoginRequest_Email: - - if err := m._validateEmail(m.GetEmail()); err != nil { - err = UserLoginRequestValidationError{ - field: "Email", - reason: "value must be a valid email address", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } - - case *UserLoginRequest_Phone: - - if !_UserLoginRequest_Phone_Pattern.MatchString(m.GetPhone()) { - err := UserLoginRequestValidationError{ - field: "Phone", - reason: "value does not match regex pattern \"^1[3-9]\\\\d{9}$\"", - } - if !all { - return err - } - errors = append(errors, err) - } - - default: - err := UserLoginRequestValidationError{ - field: "User", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - - } - - if len(errors) > 0 { - return UserLoginRequestMultiError(errors) - } - - return nil -} - -func (m *UserLoginRequest) _validateHostname(host string) error { - s := strings.ToLower(strings.TrimSuffix(host, ".")) - - if len(host) > 253 { - return errors.New("hostname cannot exceed 253 characters") - } - - for _, part := range strings.Split(s, ".") { - if l := len(part); l == 0 || l > 63 { - return errors.New("hostname part must be non-empty and cannot exceed 63 characters") - } - - if part[0] == '-' { - return errors.New("hostname parts cannot begin with hyphens") - } - - if part[len(part)-1] == '-' { - return errors.New("hostname parts cannot end with hyphens") - } - - for _, r := range part { - if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { - return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) - } - } - } - - return nil -} - -func (m *UserLoginRequest) _validateEmail(addr string) error { - a, err := mail.ParseAddress(addr) - if err != nil { - return err - } - addr = a.Address - - if len(addr) > 254 { - return errors.New("email addresses cannot exceed 254 characters") - } - - parts := strings.SplitN(addr, "@", 2) - - if len(parts[0]) > 64 { - return errors.New("email address local phrase cannot exceed 64 characters") - } - - return m._validateHostname(parts[1]) -} - -// UserLoginRequestMultiError is an error wrapping multiple validation errors -// returned by UserLoginRequest.ValidateAll() if the designated constraints -// aren't met. -type UserLoginRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UserLoginRequestMultiError) 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 UserLoginRequestMultiError) AllErrors() []error { return m } - -// UserLoginRequestValidationError is the validation error returned by -// UserLoginRequest.Validate if the designated constraints aren't met. -type UserLoginRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UserLoginRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UserLoginRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UserLoginRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UserLoginRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UserLoginRequestValidationError) ErrorName() string { return "UserLoginRequestValidationError" } - -// Error satisfies the builtin error interface -func (e UserLoginRequestValidationError) 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 %sUserLoginRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UserLoginRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UserLoginRequestValidationError{} - -var _UserLoginRequest_Phone_Pattern = regexp.MustCompile("^1[3-9]\\d{9}$") diff --git a/api/user/v1/user.proto b/api/user/v1/user.proto deleted file mode 100644 index 394b9f4..0000000 --- a/api/user/v1/user.proto +++ /dev/null @@ -1,118 +0,0 @@ -syntax = "proto3"; - -package api.user.v1; -option go_package = "api/user/v1;v1"; - -import "validate/validate.proto"; - -// import api/transport/v1/http.proto; -import "transport/response/response.proto"; - -enum LoginStatus { - LOGIN = 0; - ALREADY_LOGIN = 1; - LOGOUT = 2; -} - -message UserInternalResponse { - api.transport.response.BaseResponse response = 1; - UserInternal user = 2; -} - -// UserInternal is the internal representation of a user. -message UserInternal { - string uid = 1; - string name = 2; - optional string email = 3; - optional string phone = 4; - string avatar = 5; - // AgentID only valid when user already login. - optional string agent_id = 6; - string password = 7; - // 0: first time login, need connect to push server - // 1: already login, no need connect to push server - LoginStatus login_status = 8; - int64 created_at = 9; - int64 updated_at = 10; -} - -// User use for return user info to client. -message User { - string uid = 1; - string name = 2; - string email = 3; - string phone = 4; - string avatar = 5; - // AgentID only valid when user already login. - optional string agent_id = 6; - // 0: first time login, need connect to push server - // 1: already login, no need connect to push server - LoginStatus login_status = 8; -} - -message UserList { - repeated User users = 1; -} - -message GetUserInfoRequest { - string uid = 1 [(validate.rules).string = {min_len: 20, max_len: 24}]; -} - -message QueryUserRequest { - oneof user { - option (validate.required) = true; - string email = 1 [(validate.rules).string.email = true]; - string phone = 2 [(validate.rules).string.pattern = "^1[3-9]\\d{9}$"]; - } -} - - -message CreateUserRequest { - string name = 1 [(validate.rules).string = {min_len: 2, max_len: 20}]; - oneof user { - option (validate.required) = true; - string email = 2 [(validate.rules).string.email = true]; - string phone = 3 [(validate.rules).string.pattern = "^1[3-9]\\d{9}$"]; - } - string password = 4 [(validate.rules).string = {min_len: 6, max_len: 20}]; -} - -message UpdateUserRequest { - string uid = 1 [(validate.rules).string = {min_len: 20, max_len: 24}]; - string name = 2 [(validate.rules).string = {min_len: 2, max_len: 20, ignore_empty: true}]; - string email = 3 [(validate.rules).string = {email: true,ignore_empty: true}]; - string phone = 4 [(validate.rules).string = {pattern: "^1[3-9]\\d{9}$", ignore_empty: true}]; - string avatar = 5 [(validate.rules).string = {max_len:128, ignore_empty: true}]; -} - - -service UserService { - // GetUser get user info by uid, called when uid is known. - rpc GetUser(GetUserInfoRequest) returns (UserInternalResponse); - // QueryUser query user info by email or phone, called when uid is unknown. - rpc QueryUser(QueryUserRequest) returns (UserInternalResponse); - // CreateUser create user. - rpc CreateUser(CreateUserRequest) returns (UserInternalResponse); - // UpdateUser update user info. - rpc UpdateUser(UpdateUserRequest) returns (UserInternalResponse); -} - - - -message UserLoginRequest { - oneof user { - option (validate.required) = true; - string email = 1 [(validate.rules).string.email = true]; - string phone = 2 [(validate.rules).string.pattern = "^1[3-9]\\d{9}$"]; - } - - string password = 3; - // 0: try login , do nothing if already login - // 1: force login , logout if already login - LoginType login_type = 4; -} - -enum LoginType { - LOGIN_TYPE_TRY = 0; - LOGIN_TYPE_FORCE = 1; -} diff --git a/api/user/v1/user_grpc.pb.go b/api/user/v1/user_grpc.pb.go deleted file mode 100644 index 2c22616..0000000 --- a/api/user/v1/user_grpc.pb.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -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 - -// UserServiceClient is the client API for UserService 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 UserServiceClient interface { - // GetUser get user info by uid, called when uid is known. - GetUser(ctx context.Context, in *GetUserInfoRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) - // QueryUser query user info by email or phone, called when uid is unknown. - QueryUser(ctx context.Context, in *QueryUserRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) - // CreateUser create user. - CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) - // UpdateUser update user info. - UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) -} - -type userServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { - return &userServiceClient{cc} -} - -func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserInfoRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) { - out := new(UserInternalResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.UserService/GetUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) QueryUser(ctx context.Context, in *QueryUserRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) { - out := new(UserInternalResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.UserService/QueryUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) { - out := new(UserInternalResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.UserService/CreateUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UserInternalResponse, error) { - out := new(UserInternalResponse) - err := c.cc.Invoke(ctx, "/api.user.v1.UserService/UpdateUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// UserServiceServer is the server API for UserService service. -// All implementations must embed UnimplementedUserServiceServer -// for forward compatibility -type UserServiceServer interface { - // GetUser get user info by uid, called when uid is known. - GetUser(context.Context, *GetUserInfoRequest) (*UserInternalResponse, error) - // QueryUser query user info by email or phone, called when uid is unknown. - QueryUser(context.Context, *QueryUserRequest) (*UserInternalResponse, error) - // CreateUser create user. - CreateUser(context.Context, *CreateUserRequest) (*UserInternalResponse, error) - // UpdateUser update user info. - UpdateUser(context.Context, *UpdateUserRequest) (*UserInternalResponse, error) - mustEmbedUnimplementedUserServiceServer() -} - -// UnimplementedUserServiceServer must be embedded to have forward compatible implementations. -type UnimplementedUserServiceServer struct { -} - -func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserInfoRequest) (*UserInternalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") -} -func (UnimplementedUserServiceServer) QueryUser(context.Context, *QueryUserRequest) (*UserInternalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryUser not implemented") -} -func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*UserInternalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") -} -func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*UserInternalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") -} -func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} - -// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to UserServiceServer will -// result in compilation errors. -type UnsafeUserServiceServer interface { - mustEmbedUnimplementedUserServiceServer() -} - -func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { - s.RegisterService(&UserService_ServiceDesc, srv) -} - -func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).GetUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.UserService/GetUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserInfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_QueryUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUserRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).QueryUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.UserService/QueryUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).QueryUser(ctx, req.(*QueryUserRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateUserRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).CreateUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.UserService/CreateUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateUserRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).UpdateUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/api.user.v1.UserService/UpdateUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var UserService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "api.user.v1.UserService", - HandlerType: (*UserServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetUser", - Handler: _UserService_GetUser_Handler, - }, - { - MethodName: "QueryUser", - Handler: _UserService_QueryUser_Handler, - }, - { - MethodName: "CreateUser", - Handler: _UserService_CreateUser_Handler, - }, - { - MethodName: "UpdateUser", - Handler: _UserService_UpdateUser_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/user/v1/user.proto", -} diff --git a/apps/gateway/cmd/main.go b/apps/gateway/cmd/main.go index f385bbf..7ac4fd4 100644 --- a/apps/gateway/cmd/main.go +++ b/apps/gateway/cmd/main.go @@ -7,7 +7,8 @@ import ( swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/gateway/internal/app" "github.com/go-goim/core/apps/gateway/internal/router" "github.com/go-goim/core/apps/gateway/internal/service" diff --git a/apps/gateway/internal/router/v1/friend_router.go b/apps/gateway/internal/router/v1/friend_router.go index fe84c0f..57757ff 100644 --- a/apps/gateway/internal/router/v1/friend_router.go +++ b/apps/gateway/internal/router/v1/friend_router.go @@ -3,8 +3,9 @@ package v1 import ( "github.com/gin-gonic/gin" - responsepb "github.com/go-goim/core/api/transport/response" - friendpb "github.com/go-goim/core/api/user/friend/v1" + responsepb "github.com/go-goim/api/transport/response" + friendpb "github.com/go-goim/api/user/friend/v1" + "github.com/go-goim/core/apps/gateway/internal/service" "github.com/go-goim/core/pkg/mid" "github.com/go-goim/core/pkg/request" diff --git a/apps/gateway/internal/router/v1/offline_message_router.go b/apps/gateway/internal/router/v1/offline_message_router.go index 37eae56..5c0e90c 100644 --- a/apps/gateway/internal/router/v1/offline_message_router.go +++ b/apps/gateway/internal/router/v1/offline_message_router.go @@ -3,7 +3,8 @@ package v1 import ( "github.com/gin-gonic/gin" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/gateway/internal/service" "github.com/go-goim/core/pkg/mid" "github.com/go-goim/core/pkg/request" diff --git a/apps/gateway/internal/router/v1/send_msg_router.go b/apps/gateway/internal/router/v1/send_msg_router.go index 91bb200..e00723d 100644 --- a/apps/gateway/internal/router/v1/send_msg_router.go +++ b/apps/gateway/internal/router/v1/send_msg_router.go @@ -3,8 +3,9 @@ package v1 import ( "github.com/gin-gonic/gin" - messagev1 "github.com/go-goim/core/api/message/v1" - responsepb "github.com/go-goim/core/api/transport/response" + messagev1 "github.com/go-goim/api/message/v1" + responsepb "github.com/go-goim/api/transport/response" + "github.com/go-goim/core/apps/gateway/internal/service" "github.com/go-goim/core/pkg/mid" "github.com/go-goim/core/pkg/request" diff --git a/apps/gateway/internal/router/v1/user_router.go b/apps/gateway/internal/router/v1/user_router.go index 61a68a7..7350f8d 100644 --- a/apps/gateway/internal/router/v1/user_router.go +++ b/apps/gateway/internal/router/v1/user_router.go @@ -3,7 +3,8 @@ package v1 import ( "github.com/gin-gonic/gin" - userv1 "github.com/go-goim/core/api/user/v1" + userv1 "github.com/go-goim/api/user/v1" + "github.com/go-goim/core/apps/gateway/internal/service" "github.com/go-goim/core/pkg/mid" "github.com/go-goim/core/pkg/request" diff --git a/apps/gateway/internal/service/friend_service.go b/apps/gateway/internal/service/friend_service.go index a839d3e..0fa2312 100644 --- a/apps/gateway/internal/service/friend_service.go +++ b/apps/gateway/internal/service/friend_service.go @@ -10,8 +10,9 @@ import ( ggrpc "google.golang.org/grpc" "google.golang.org/grpc/connectivity" - responsepb "github.com/go-goim/core/api/transport/response" - friendpb "github.com/go-goim/core/api/user/friend/v1" + responsepb "github.com/go-goim/api/transport/response" + friendpb "github.com/go-goim/api/user/friend/v1" + "github.com/go-goim/core/apps/gateway/internal/app" ) diff --git a/apps/gateway/internal/service/offline_message_service.go b/apps/gateway/internal/service/offline_message_service.go index 002f697..4561183 100644 --- a/apps/gateway/internal/service/offline_message_service.go +++ b/apps/gateway/internal/service/offline_message_service.go @@ -9,7 +9,8 @@ import ( ggrpc "google.golang.org/grpc" "google.golang.org/grpc/connectivity" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/gateway/internal/app" ) diff --git a/apps/gateway/internal/service/send_message_service.go b/apps/gateway/internal/service/send_message_service.go index 21b3c93..64af3ba 100644 --- a/apps/gateway/internal/service/send_message_service.go +++ b/apps/gateway/internal/service/send_message_service.go @@ -11,11 +11,13 @@ import ( ggrpc "google.golang.org/grpc" "google.golang.org/grpc/connectivity" - responsepb "github.com/go-goim/core/api/transport/response" - friendpb "github.com/go-goim/core/api/user/friend/v1" + responsepb "github.com/go-goim/api/transport/response" + friendpb "github.com/go-goim/api/user/friend/v1" + "github.com/go-goim/core/pkg/log" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/gateway/internal/app" "github.com/go-goim/core/pkg/mq" ) diff --git a/apps/gateway/internal/service/user_service.go b/apps/gateway/internal/service/user_service.go index ce6fa09..b4263da 100644 --- a/apps/gateway/internal/service/user_service.go +++ b/apps/gateway/internal/service/user_service.go @@ -10,8 +10,9 @@ import ( ggrpc "google.golang.org/grpc" "google.golang.org/grpc/connectivity" - responsepb "github.com/go-goim/core/api/transport/response" - userv1 "github.com/go-goim/core/api/user/v1" + responsepb "github.com/go-goim/api/transport/response" + userv1 "github.com/go-goim/api/user/v1" + "github.com/go-goim/core/apps/gateway/internal/app" "github.com/go-goim/core/apps/gateway/internal/dao" "github.com/go-goim/core/pkg/log" diff --git a/apps/msg/cmd/main.go b/apps/msg/cmd/main.go index b7c95bc..03caed3 100644 --- a/apps/msg/cmd/main.go +++ b/apps/msg/cmd/main.go @@ -6,7 +6,8 @@ import ( "github.com/go-goim/core/pkg/cmd" "github.com/go-goim/core/pkg/log" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/msg/internal/app" "github.com/go-goim/core/apps/msg/internal/service" "github.com/go-goim/core/pkg/graceful" diff --git a/apps/msg/internal/service/msg_service.go b/apps/msg/internal/service/msg_service.go index bd3cf67..15607b7 100644 --- a/apps/msg/internal/service/msg_service.go +++ b/apps/msg/internal/service/msg_service.go @@ -18,7 +18,8 @@ import ( "github.com/go-goim/core/pkg/consts" "github.com/go-goim/core/pkg/log" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/msg/internal/app" "github.com/go-goim/core/pkg/conn/pool" "github.com/go-goim/core/pkg/conn/wrapper" diff --git a/apps/msg/internal/service/offline_message_service.go b/apps/msg/internal/service/offline_message_service.go index 6261ada..536090a 100644 --- a/apps/msg/internal/service/offline_message_service.go +++ b/apps/msg/internal/service/offline_message_service.go @@ -8,11 +8,13 @@ import ( "github.com/apache/rocketmq-client-go/v2/primitive" redisv8 "github.com/go-redis/redis/v8" - responsepb "github.com/go-goim/core/api/transport/response" + responsepb "github.com/go-goim/api/transport/response" + "github.com/go-goim/core/pkg/consts" "github.com/go-goim/core/pkg/log" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/msg/internal/app" ) diff --git a/apps/push/cmd/main.go b/apps/push/cmd/main.go index 96db894..a0375ff 100644 --- a/apps/push/cmd/main.go +++ b/apps/push/cmd/main.go @@ -6,7 +6,8 @@ import ( "github.com/gin-gonic/gin" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/apps/push/internal/app" "github.com/go-goim/core/apps/push/internal/router" "github.com/go-goim/core/apps/push/internal/service" diff --git a/apps/push/internal/service/push_message.go b/apps/push/internal/service/push_message.go index a1b404a..8be1fec 100644 --- a/apps/push/internal/service/push_message.go +++ b/apps/push/internal/service/push_message.go @@ -7,10 +7,12 @@ import ( "github.com/gorilla/websocket" - responsepb "github.com/go-goim/core/api/transport/response" + responsepb "github.com/go-goim/api/transport/response" + "github.com/go-goim/core/pkg/log" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" + "github.com/go-goim/core/pkg/conn/pool" "github.com/go-goim/core/pkg/conn/wrapper" "github.com/go-goim/core/pkg/graceful" diff --git a/apps/user/cmd/main.go b/apps/user/cmd/main.go index 4d31d5b..88f141a 100644 --- a/apps/user/cmd/main.go +++ b/apps/user/cmd/main.go @@ -5,8 +5,9 @@ import ( "github.com/gin-gonic/gin" - friendpb "github.com/go-goim/core/api/user/friend/v1" - userv1 "github.com/go-goim/core/api/user/v1" + friendpb "github.com/go-goim/api/user/friend/v1" + userv1 "github.com/go-goim/api/user/v1" + "github.com/go-goim/core/apps/user/internal/app" "github.com/go-goim/core/apps/user/internal/router" "github.com/go-goim/core/apps/user/internal/service" diff --git a/apps/user/internal/data/friend.go b/apps/user/internal/data/friend.go index fb6991d..a7f1166 100644 --- a/apps/user/internal/data/friend.go +++ b/apps/user/internal/data/friend.go @@ -1,7 +1,7 @@ package data import ( - friendpb "github.com/go-goim/core/api/user/friend/v1" + friendpb "github.com/go-goim/api/user/friend/v1" ) // Friend is the model of user relation table based on gorm, which is used for user relation management. diff --git a/apps/user/internal/data/friend_request.go b/apps/user/internal/data/friend_request.go index 577e868..0f6184c 100644 --- a/apps/user/internal/data/friend_request.go +++ b/apps/user/internal/data/friend_request.go @@ -1,7 +1,7 @@ package data import ( - friendpb "github.com/go-goim/core/api/user/friend/v1" + friendpb "github.com/go-goim/api/user/friend/v1" ) // FriendRequest is the model of fiend request table based on gorm, which is used for add friend request. diff --git a/apps/user/internal/data/user.go b/apps/user/internal/data/user.go index 2a8a158..9438e70 100644 --- a/apps/user/internal/data/user.go +++ b/apps/user/internal/data/user.go @@ -1,7 +1,7 @@ package data import ( - userv1 "github.com/go-goim/core/api/user/v1" + userv1 "github.com/go-goim/api/user/v1" ) // User is the model of user table based on gorm, which contains user basic info. diff --git a/apps/user/internal/service/friend_service.go b/apps/user/internal/service/friend_service.go index 0ff61d2..d9f7d96 100644 --- a/apps/user/internal/service/friend_service.go +++ b/apps/user/internal/service/friend_service.go @@ -4,8 +4,9 @@ import ( "context" "sync" - responsepb "github.com/go-goim/core/api/transport/response" - friendpb "github.com/go-goim/core/api/user/friend/v1" + responsepb "github.com/go-goim/api/transport/response" + friendpb "github.com/go-goim/api/user/friend/v1" + "github.com/go-goim/core/apps/user/internal/app" "github.com/go-goim/core/apps/user/internal/dao" "github.com/go-goim/core/apps/user/internal/data" diff --git a/apps/user/internal/service/user_service.go b/apps/user/internal/service/user_service.go index aa2f56f..3fb72e3 100644 --- a/apps/user/internal/service/user_service.go +++ b/apps/user/internal/service/user_service.go @@ -5,8 +5,9 @@ import ( "fmt" "sync" - responsepb "github.com/go-goim/core/api/transport/response" - userv1 "github.com/go-goim/core/api/user/v1" + responsepb "github.com/go-goim/api/transport/response" + userv1 "github.com/go-goim/api/user/v1" + "github.com/go-goim/core/apps/user/internal/dao" "github.com/go-goim/core/apps/user/internal/data" "github.com/go-goim/core/pkg/util" diff --git a/gen_proto.sh b/gen_proto.sh deleted file mode 100755 index 794cccc..0000000 --- a/gen_proto.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# define function -function gen_proto() { - # scan all files in the giving directory - # and generate proto files - for file in $(ls $1) - do - # check if the file is a proto file - if [[ $file == *.proto ]] - then - echo "generating $1/$file" - # check if the file is a response.proto file - if [[ $file == *response.proto ]] - then - # print the message in red color - echo -e "\033[31m SPECIAL CASE $1/$file \033[0m" - # generate response.proto file - protoc --proto_path=. --proto_path=./third_party \ - --go_out=paths=source_relative:. \ - --go-grpc_out=paths=source_relative:. \ - --validate_out=lang=go,paths=source_relative:. \ - $1/$file - else - # generate other proto file - protoc --proto_path=. --proto_path=./third_party --proto_path=./api \ - --go_out=paths=source_relative:. \ - --go-grpc_out=paths=source_relative:. \ - --validate_out=lang=go,paths=source_relative:. \ - $1/$file - fi - fi - # check if the file is a directory and if it is not a hidden directory - if [[ -d $1/$file && $file != .* ]] - then - # call the function recursively - gen_proto $1/$file - fi - done -} - -gen_proto $1 \ No newline at end of file diff --git a/go.mod b/go.mod index a857b9c..e3c0f7e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( github.com/apache/rocketmq-client-go/v2 v2.1.0 github.com/btcsuite/btcd/btcutil v1.1.1 - github.com/envoyproxy/protoc-gen-validate v0.1.0 + github.com/envoyproxy/protoc-gen-validate v0.6.7 // indirect github.com/gin-gonic/gin v1.7.7 github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20220301040457-03ad2b663624 github.com/go-kratos/kratos/v2 v2.3.0 @@ -22,7 +22,7 @@ require ( go.etcd.io/etcd/client/v3 v3.5.4 go.uber.org/atomic v1.7.0 go.uber.org/zap v1.17.0 - google.golang.org/grpc v1.46.2 + google.golang.org/grpc v1.47.0 google.golang.org/protobuf v1.28.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 gorm.io/driver/mysql v1.3.3 @@ -30,6 +30,7 @@ require ( ) require ( + github.com/go-goim/api v0.0.1 github.com/go-kratos/kratos/contrib/config/etcd/v2 v2.0.0-20220528114537-97c103a39562 github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 github.com/swaggo/gin-swagger v1.4.3 diff --git a/go.sum b/go.sum index 4e39394..313f2f2 100644 --- a/go.sum +++ b/go.sum @@ -87,8 +87,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.7 h1:qcZcULcd/abmQg6dwigimCNEyi4gg31M/xaciQlDml8= +github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -105,6 +106,8 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= +github.com/go-goim/api v0.0.1 h1:0fdNNO/RT3JopqnRSosKCSb0XNfD4GtqkpsHr8KIRUE= +github.com/go-goim/api v0.0.1/go.mod h1:ji/c3E0UlOw44NK3pjJZvhdYBA+5vCir9Xra/RYnNLw= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -237,6 +240,7 @@ github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn github.com/hashicorp/serf v0.9.6 h1:uuEX1kLR6aoda1TBttmJQKDLZE1Ob7KN0NPdE7EtCDc= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -266,6 +270,7 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -275,6 +280,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= @@ -341,6 +347,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -379,6 +386,8 @@ github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:s github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -445,6 +454,7 @@ go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -460,6 +470,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -486,6 +497,7 @@ golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -545,6 +557,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= @@ -573,6 +586,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= @@ -601,8 +615,9 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/pkg/config/config.go b/pkg/config/config.go index e3ddf68..9d8ab2a 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -4,8 +4,9 @@ import ( "github.com/go-kratos/kratos/v2/config" "github.com/go-kratos/kratos/v2/config/file" - registryv1 "github.com/go-goim/core/api/config/registry/v1" - configv1 "github.com/go-goim/core/api/config/v1" + registryv1 "github.com/go-goim/api/config/registry/v1" + configv1 "github.com/go-goim/api/config/v1" + "github.com/go-goim/core/pkg/cmd" "github.com/go-goim/core/pkg/log" ) diff --git a/pkg/config/source.go b/pkg/config/source.go index ceaa341..007246e 100644 --- a/pkg/config/source.go +++ b/pkg/config/source.go @@ -8,7 +8,8 @@ import ( "github.com/hashicorp/consul/api" clientv3 "go.etcd.io/etcd/client/v3" - registryv1 "github.com/go-goim/core/api/config/registry/v1" + registryv1 "github.com/go-goim/api/config/registry/v1" + "github.com/go-goim/core/pkg/config/consul" ) diff --git a/pkg/db/mysql/options.go b/pkg/db/mysql/options.go index 0c2f9e4..bab22a7 100644 --- a/pkg/db/mysql/options.go +++ b/pkg/db/mysql/options.go @@ -3,7 +3,7 @@ package mysql import ( "time" - configv1 "github.com/go-goim/core/api/config/v1" + configv1 "github.com/go-goim/api/config/v1" ) type Option func(*option) diff --git a/pkg/db/redis/options.go b/pkg/db/redis/options.go index 9e8c02a..8d85e8c 100644 --- a/pkg/db/redis/options.go +++ b/pkg/db/redis/options.go @@ -3,7 +3,7 @@ package redis import ( "time" - configv1 "github.com/go-goim/core/api/config/v1" + configv1 "github.com/go-goim/api/config/v1" ) type Option func(*options) diff --git a/pkg/log/log.go b/pkg/log/log.go index 555ad45..c3135ff 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -3,7 +3,7 @@ package log import ( kraoslogger "github.com/go-kratos/kratos/v2/log" - configv1 "github.com/go-goim/core/api/config/v1" + configv1 "github.com/go-goim/api/config/v1" ) // define log api and implement diff --git a/pkg/log/option.go b/pkg/log/option.go index 4d14ede..e67c725 100644 --- a/pkg/log/option.go +++ b/pkg/log/option.go @@ -4,7 +4,7 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" - configv1 "github.com/go-goim/core/api/config/v1" + configv1 "github.com/go-goim/api/config/v1" ) type option struct { diff --git a/pkg/log/zap.go b/pkg/log/zap.go index d2ddcdf..7201dd2 100644 --- a/pkg/log/zap.go +++ b/pkg/log/zap.go @@ -10,7 +10,7 @@ import ( "go.uber.org/zap/zapcore" "gopkg.in/natefinch/lumberjack.v2" - configv1 "github.com/go-goim/core/api/config/v1" + configv1 "github.com/go-goim/api/config/v1" ) type zapLogger struct { diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index 76561ca..04ff0b1 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -11,7 +11,7 @@ import ( "github.com/go-goim/core/pkg/registry/consul" - registryv1 "github.com/go-goim/core/api/config/registry/v1" + registryv1 "github.com/go-goim/api/config/registry/v1" ) var ( diff --git a/pkg/request/jsonpb.go b/pkg/request/jsonpb.go index 0f5967b..8063060 100644 --- a/pkg/request/jsonpb.go +++ b/pkg/request/jsonpb.go @@ -9,7 +9,8 @@ import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" - responsepb "github.com/go-goim/core/api/transport/response" + responsepb "github.com/go-goim/api/transport/response" + "github.com/go-goim/core/pkg/mid" ) diff --git a/pkg/response/gin_resp.go b/pkg/response/gin_resp.go index e15e8be..4a94acf 100644 --- a/pkg/response/gin_resp.go +++ b/pkg/response/gin_resp.go @@ -5,7 +5,8 @@ import ( "github.com/gin-gonic/gin" - responsepb "github.com/go-goim/core/api/transport/response" + responsepb "github.com/go-goim/api/transport/response" + "github.com/go-goim/core/pkg/log" ) diff --git a/pkg/response/response.go b/pkg/response/response.go index bacc003..05987bf 100644 --- a/pkg/response/response.go +++ b/pkg/response/response.go @@ -1,7 +1,7 @@ package response import ( - responsepb "github.com/go-goim/core/api/transport/response" + responsepb "github.com/go-goim/api/transport/response" ) type BaseResponse struct { diff --git a/tests/batch-user/user.go b/tests/batch-user/user.go index c7cb8f8..b042b61 100644 --- a/tests/batch-user/user.go +++ b/tests/batch-user/user.go @@ -9,7 +9,8 @@ import ( "net/http" "strings" - userv1 "github.com/go-goim/core/api/user/v1" + userv1 "github.com/go-goim/api/user/v1" + "github.com/go-goim/core/pkg/response" ) diff --git a/tests/client-bench/main.go b/tests/client-bench/main.go index e257024..5cebca8 100644 --- a/tests/client-bench/main.go +++ b/tests/client-bench/main.go @@ -14,7 +14,7 @@ import ( "syscall" "time" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" ) var ( diff --git a/tests/client-gui/client.go b/tests/client-gui/client.go index c812f04..270bedb 100644 --- a/tests/client-gui/client.go +++ b/tests/client-gui/client.go @@ -15,7 +15,7 @@ import ( "github.com/gorilla/websocket" "github.com/jroimartin/gocui" - messagev1 "github.com/go-goim/core/api/message/v1" + messagev1 "github.com/go-goim/api/message/v1" ) var ( diff --git a/third_party/google/protobuf/any.proto b/third_party/google/protobuf/any.proto deleted file mode 100644 index c9be854..0000000 --- a/third_party/google/protobuf/any.proto +++ /dev/null @@ -1,155 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/any"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; -} diff --git a/third_party/google/protobuf/descriptor.proto b/third_party/google/protobuf/descriptor.proto deleted file mode 100644 index ec568c3..0000000 --- a/third_party/google/protobuf/descriptor.proto +++ /dev/null @@ -1,911 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - - -syntax = "proto2"; - -package google.protobuf; - -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// descriptor.proto must be optimized for speed because reflection-based -// algorithms don't work during bootstrapping. -option optimize_for = SPEED; - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} - -// Describes a complete .proto file. -message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. - - // Names of files imported by this file. - repeated string dependency = 3; - // Indexes of the public imported files in the dependency list above. - repeated int32 public_dependency = 10; - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - repeated int32 weak_dependency = 11; - - // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - - optional FileOptions options = 8; - - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - optional SourceCodeInfo source_code_info = 9; - - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - optional string syntax = 12; -} - -// Describes a message type. -message DescriptorProto { - optional string name = 1; - - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - - message ExtensionRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - - optional ExtensionRangeOptions options = 3; - } - repeated ExtensionRange extension_range = 5; - - repeated OneofDescriptorProto oneof_decl = 8; - - optional MessageOptions options = 7; - - // Range of reserved tag numbers. Reserved tag numbers may not be used by - // fields or extension ranges in the same message. Reserved ranges may - // not overlap. - message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - } - repeated ReservedRange reserved_range = 9; - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - repeated string reserved_name = 10; -} - -message ExtensionRangeOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -// Describes a field within a message. -message FieldDescriptorProto { - enum Type { - // 0 is reserved for errors. - // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. - - // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - } - - enum Label { - // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - } - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - optional Type type = 5; - - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - optional string type_name = 6; - - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - optional string extendee = 2; - - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - optional string default_value = 7; - - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - optional int32 oneof_index = 9; - - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - optional string json_name = 10; - - optional FieldOptions options = 8; - - // If true, this is a proto3 "optional". When a proto3 field is optional, it - // tracks presence regardless of field type. - // - // When proto3_optional is true, this field must be belong to a oneof to - // signal to old proto3 clients that presence is tracked for this field. This - // oneof is known as a "synthetic" oneof, and this field must be its sole - // member (each proto3 optional field gets its own synthetic oneof). Synthetic - // oneofs exist in the descriptor only, and do not generate any API. Synthetic - // oneofs must be ordered after all "real" oneofs. - // - // For message fields, proto3_optional doesn't create any semantic change, - // since non-repeated message fields always track presence. However it still - // indicates the semantic detail of whether the user wrote "optional" or not. - // This can be useful for round-tripping the .proto file. For consistency we - // give message fields a synthetic oneof also, even though it is not required - // to track presence. This is especially important because the parser can't - // tell if a field is a message or an enum, so it must always create a - // synthetic oneof. - // - // Proto2 optional fields do not set this flag, because they already indicate - // optional with `LABEL_OPTIONAL`. - optional bool proto3_optional = 17; -} - -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} - -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - optional EnumOptions options = 3; - - // Range of reserved numeric values. Reserved values may not be used by - // entries in the same enum. Reserved ranges may not overlap. - // - // Note that this is distinct from DescriptorProto.ReservedRange in that it - // is inclusive such that it can appropriately represent the entire int32 - // domain. - message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. - } - - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - repeated EnumReservedRange reserved_range = 4; - - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - repeated string reserved_name = 5; -} - -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - optional EnumValueOptions options = 3; -} - -// Describes a service. -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - - optional ServiceOptions options = 3; -} - -// Describes a method of a service. -message MethodDescriptorProto { - optional string name = 1; - - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; - optional string output_type = 3; - - optional MethodOptions options = 4; - - // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default = false]; - // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default = false]; -} - - -// =================================================================== -// Options - -// Each of the definitions above may have "options" attached. These are -// just annotations which may cause code to be generated slightly differently -// or may contain hints for code that manipulates protocol messages. -// -// Clients may define custom options as extensions of the *Options messages. -// These extensions may not yet be known at parsing time, so the parser cannot -// store the values in them. Instead it stores them in a field in the *Options -// message called uninterpreted_option. This field must have the same name -// across all *Options messages. We then use this field to populate the -// extensions when we build a descriptor, at which point all protos have been -// parsed and so all extensions are known. -// -// Extension numbers for custom options may be chosen as follows: -// * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. -// * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Objective-C plugin) and your project website (if available) -- there's no -// need to explain how you intend to use them. Usually you only need one -// extension number. You can declare multiple options with only one extension -// number by putting them in a sub-message. See the Custom Options section of -// the docs for examples: -// https://developers.google.com/protocol-buffers/docs/proto#options -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. - -message FileOptions { - - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - optional string java_package = 1; - - - // Controls the name of the wrapper Java class generated for the .proto file. - // That class will always contain the .proto file's getDescriptor() method as - // well as any top-level extensions defined in the .proto file. - // If java_multiple_files is disabled, then all the other classes from the - // .proto file will be nested inside the single wrapper outer class. - optional string java_outer_classname = 8; - - // If enabled, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the wrapper class - // named by java_outer_classname. However, the wrapper class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default = false]; - - // This option does nothing. - optional bool java_generate_equals_and_hash = 20 [deprecated=true]; - - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default = false]; - - - // Generated classes can be optimized for speed or code size. - enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. - } - optional OptimizeMode optimize_for = 9 [default = SPEED]; - - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - optional string go_package = 11; - - - - - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool php_generic_services = 42 [default = false]; - - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default = false]; - - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default = true]; - - - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - optional string objc_class_prefix = 36; - - // Namespace for generated classes; defaults to the package. - optional string csharp_namespace = 37; - - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - optional string swift_prefix = 39; - - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - optional string php_class_prefix = 40; - - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - optional string php_namespace = 41; - - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be - // used for determining the namespace. - optional string php_metadata_namespace = 44; - - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - optional string ruby_package = 45; - - - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. - // See the documentation for the "Options" section above. - extensions 1000 to max; - - reserved 38; -} - -message MessageOptions { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - optional bool message_set_wire_format = 1 [default = false]; - - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default = false]; - - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default = false]; - - reserved 4, 5, 6; - - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementations still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - optional bool map_entry = 7; - - reserved 8; // javalite_serializable - reserved 9; // javanano_as_lite - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message FieldOptions { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - optional CType ctype = 1 [default = STRING]; - enum CType { - // Default mode. - STRING = 0; - - CORD = 1; - - STRING_PIECE = 2; - } - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - optional bool packed = 2; - - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - optional JSType jstype = 6 [default = JS_NORMAL]; - enum JSType { - // Use the default type. - JS_NORMAL = 0; - - // Use JavaScript strings. - JS_STRING = 1; - - // Use JavaScript numbers. - JS_NUMBER = 2; - } - - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - optional bool lazy = 5 [default = false]; - - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - optional bool deprecated = 3 [default = false]; - - // For Google-internal migration only. Do not use. - optional bool weak = 10 [default = false]; - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; - - reserved 4; // removed jtype -} - -message OneofOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumOptions { - - // Set this option to true to allow mapping different tag names to the same - // value. - optional bool allow_alias = 2; - - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - optional bool deprecated = 3 [default = false]; - - reserved 5; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumValueOptions { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default = false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message ServiceOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - optional bool deprecated = 33 [default = false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MethodOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default = false]; - - // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - // or neither? HTTP based RPC implementation may choose GET verb for safe - // methods, and PUT verb for idempotent methods instead of the default POST. - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects - } - optional IdempotencyLevel idempotency_level = 34 - [default = IDEMPOTENCY_UNKNOWN]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -message UninterpretedOption { - // The name of the uninterpreted option. Each string represents a segment in - // a dot-separated name. is_extension is true iff a segment represents an - // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - // "foo.(bar.baz).qux". - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } - repeated NamePart name = 2; - - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; -} - -// =================================================================== -// Optional source code info - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -message SourceCodeInfo { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendant. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - repeated Location location = 1; - message Location { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition occurs. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - repeated int32 path = 1 [packed = true]; - - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - repeated int32 span = 2 [packed = true]; - - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -message GeneratedCodeInfo { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - repeated Annotation annotation = 1; - message Annotation { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - repeated int32 path = 1 [packed = true]; - - // Identifies the filesystem path to the original source .proto. - optional string source_file = 2; - - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - optional int32 begin = 3; - - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - optional int32 end = 4; - } -} \ No newline at end of file diff --git a/third_party/google/protobuf/duration.proto b/third_party/google/protobuf/duration.proto deleted file mode 100644 index cb7cf0e..0000000 --- a/third_party/google/protobuf/duration.proto +++ /dev/null @@ -1,116 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; -option go_package = "google.golang.org/protobuf/types/known/durationpb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DurationProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// A Duration represents a signed, fixed-length span of time represented -// as a count of seconds and fractions of seconds at nanosecond -// resolution. It is independent of any calendar and concepts like "day" -// or "month". It is related to Timestamp in that the difference between -// two Timestamp values is a Duration and it can be added or subtracted -// from a Timestamp. Range is approximately +-10,000 years. -// -// # Examples -// -// Example 1: Compute Duration from two Timestamps in pseudo code. -// -// Timestamp start = ...; -// Timestamp end = ...; -// Duration duration = ...; -// -// duration.seconds = end.seconds - start.seconds; -// duration.nanos = end.nanos - start.nanos; -// -// if (duration.seconds < 0 && duration.nanos > 0) { -// duration.seconds += 1; -// duration.nanos -= 1000000000; -// } else if (duration.seconds > 0 && duration.nanos < 0) { -// duration.seconds -= 1; -// duration.nanos += 1000000000; -// } -// -// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -// -// Timestamp start = ...; -// Duration duration = ...; -// Timestamp end = ...; -// -// end.seconds = start.seconds + duration.seconds; -// end.nanos = start.nanos + duration.nanos; -// -// if (end.nanos < 0) { -// end.seconds -= 1; -// end.nanos += 1000000000; -// } else if (end.nanos >= 1000000000) { -// end.seconds += 1; -// end.nanos -= 1000000000; -// } -// -// Example 3: Compute Duration from datetime.timedelta in Python. -// -// td = datetime.timedelta(days=3, minutes=10) -// duration = Duration() -// duration.FromTimedelta(td) -// -// # JSON Mapping -// -// In JSON format, the Duration type is encoded as a string rather than an -// object, where the string ends in the suffix "s" (indicating seconds) and -// is preceded by the number of seconds, with nanoseconds expressed as -// fractional seconds. For example, 3 seconds with 0 nanoseconds should be -// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should -// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 -// microsecond should be expressed in JSON format as "3.000001s". -// -// -message Duration { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. Note: these bounds are computed from: - // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - int64 seconds = 1; - - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - int32 nanos = 2; -} \ No newline at end of file diff --git a/third_party/google/protobuf/timestamp.proto b/third_party/google/protobuf/timestamp.proto deleted file mode 100644 index cd35786..0000000 --- a/third_party/google/protobuf/timestamp.proto +++ /dev/null @@ -1,138 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/timestamp"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "TimestampProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// A Timestamp represents a point in time independent of any time zone or local -// calendar, encoded as a count of seconds and fractions of seconds at -// nanosecond resolution. The count is relative to an epoch at UTC midnight on -// January 1, 1970, in the proleptic Gregorian calendar which extends the -// Gregorian calendar backwards to year one. -// -// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -// second table is needed for interpretation, using a [24-hour linear -// smear](https://developers.google.com/time/smear). -// -// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -// restricting to that range, we ensure that we can convert to and from [RFC -// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -// -// # Examples -// -// Example 1: Compute Timestamp from POSIX `time()`. -// -// Timestamp timestamp; -// timestamp.set_seconds(time(NULL)); -// timestamp.set_nanos(0); -// -// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -// -// struct timeval tv; -// gettimeofday(&tv, NULL); -// -// Timestamp timestamp; -// timestamp.set_seconds(tv.tv_sec); -// timestamp.set_nanos(tv.tv_usec * 1000); -// -// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -// -// FILETIME ft; -// GetSystemTimeAsFileTime(&ft); -// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -// -// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -// Timestamp timestamp; -// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -// -// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -// -// long millis = System.currentTimeMillis(); -// -// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -// .setNanos((int) ((millis % 1000) * 1000000)).build(); -// -// -// Example 5: Compute Timestamp from current time in Python. -// -// timestamp = Timestamp() -// timestamp.GetCurrentTime() -// -// # JSON Mapping -// -// In JSON format, the Timestamp type is encoded as a string in the -// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -// where {year} is always expressed using four digits while {month}, {day}, -// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required. A proto3 JSON serializer should always use UTC (as indicated by -// "Z") when printing the Timestamp type and a proto3 JSON parser should be -// able to accept both UTC and other timezones (as indicated by an offset). -// -// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -// 01:30 UTC on January 15, 2017. -// -// In JavaScript, one can convert a Date object to this format using the -// standard -// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) -// method. In Python, a standard `datetime.datetime` object can be converted -// to this format using -// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with -// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use -// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D -// ) to obtain a formatter capable of generating timestamps in this format. -// -// -message Timestamp { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} diff --git a/third_party/validate/validate.proto b/third_party/validate/validate.proto deleted file mode 100644 index 42561c3..0000000 --- a/third_party/validate/validate.proto +++ /dev/null @@ -1,862 +0,0 @@ -syntax = "proto2"; -package validate; - -option go_package = "github.com/envoyproxy/protoc-gen-validate/validate"; -option java_package = "io.envoyproxy.pgv.validate"; - -import "google/protobuf/descriptor.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -// Validation rules applied at the message level -extend google.protobuf.MessageOptions { - // Disabled nullifies any validation rules for this message, including any - // message fields associated with it that do support validation. - optional bool disabled = 1071; - // Ignore skips generation of validation methods for this message. - optional bool ignored = 1072; -} - -// Validation rules applied at the oneof level -extend google.protobuf.OneofOptions { - // Required ensures that exactly one the field options in a oneof is set; - // validation fails if no fields in the oneof are set. - optional bool required = 1071; -} - -// Validation rules applied at the field level -extend google.protobuf.FieldOptions { - // Rules specify the validations to be performed on this field. By default, - // no validation is performed against a field. - optional FieldRules rules = 1071; -} - -// FieldRules encapsulates the rules for each type of field. Depending on the -// field, the correct set should be used to ensure proper validations. -message FieldRules { - optional MessageRules message = 17; - oneof type { - // Scalar Field Types - FloatRules float = 1; - DoubleRules double = 2; - Int32Rules int32 = 3; - Int64Rules int64 = 4; - UInt32Rules uint32 = 5; - UInt64Rules uint64 = 6; - SInt32Rules sint32 = 7; - SInt64Rules sint64 = 8; - Fixed32Rules fixed32 = 9; - Fixed64Rules fixed64 = 10; - SFixed32Rules sfixed32 = 11; - SFixed64Rules sfixed64 = 12; - BoolRules bool = 13; - StringRules string = 14; - BytesRules bytes = 15; - - // Complex Field Types - EnumRules enum = 16; - RepeatedRules repeated = 18; - MapRules map = 19; - - // Well-Known Field Types - AnyRules any = 20; - DurationRules duration = 21; - TimestampRules timestamp = 22; - } -} - -// FloatRules describes the constraints applied to `float` values -message FloatRules { - // Const specifies that this field must be exactly the specified value - optional float const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional float lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional float lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional float gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional float gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated float in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated float not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// DoubleRules describes the constraints applied to `double` values -message DoubleRules { - // Const specifies that this field must be exactly the specified value - optional double const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional double lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional double lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional double gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional double gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated double in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated double not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Int32Rules describes the constraints applied to `int32` values -message Int32Rules { - // Const specifies that this field must be exactly the specified value - optional int32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional int32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional int32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional int32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional int32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated int32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated int32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Int64Rules describes the constraints applied to `int64` values -message Int64Rules { - // Const specifies that this field must be exactly the specified value - optional int64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional int64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional int64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional int64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional int64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated int64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated int64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// UInt32Rules describes the constraints applied to `uint32` values -message UInt32Rules { - // Const specifies that this field must be exactly the specified value - optional uint32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional uint32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional uint32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional uint32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional uint32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated uint32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated uint32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// UInt64Rules describes the constraints applied to `uint64` values -message UInt64Rules { - // Const specifies that this field must be exactly the specified value - optional uint64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional uint64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional uint64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional uint64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional uint64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated uint64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated uint64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SInt32Rules describes the constraints applied to `sint32` values -message SInt32Rules { - // Const specifies that this field must be exactly the specified value - optional sint32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sint32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sint32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sint32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sint32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sint32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sint32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SInt64Rules describes the constraints applied to `sint64` values -message SInt64Rules { - // Const specifies that this field must be exactly the specified value - optional sint64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sint64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sint64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sint64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sint64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sint64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sint64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Fixed32Rules describes the constraints applied to `fixed32` values -message Fixed32Rules { - // Const specifies that this field must be exactly the specified value - optional fixed32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional fixed32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional fixed32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional fixed32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional fixed32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated fixed32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated fixed32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// Fixed64Rules describes the constraints applied to `fixed64` values -message Fixed64Rules { - // Const specifies that this field must be exactly the specified value - optional fixed64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional fixed64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional fixed64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional fixed64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional fixed64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated fixed64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated fixed64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SFixed32Rules describes the constraints applied to `sfixed32` values -message SFixed32Rules { - // Const specifies that this field must be exactly the specified value - optional sfixed32 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sfixed32 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sfixed32 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sfixed32 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sfixed32 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sfixed32 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sfixed32 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// SFixed64Rules describes the constraints applied to `sfixed64` values -message SFixed64Rules { - // Const specifies that this field must be exactly the specified value - optional sfixed64 const = 1; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional sfixed64 lt = 2; - - // Lte specifies that this field must be less than or equal to the - // specified value, inclusive - optional sfixed64 lte = 3; - - // Gt specifies that this field must be greater than the specified value, - // exclusive. If the value of Gt is larger than a specified Lt or Lte, the - // range is reversed. - optional sfixed64 gt = 4; - - // Gte specifies that this field must be greater than or equal to the - // specified value, inclusive. If the value of Gte is larger than a - // specified Lt or Lte, the range is reversed. - optional sfixed64 gte = 5; - - // In specifies that this field must be equal to one of the specified - // values - repeated sfixed64 in = 6; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated sfixed64 not_in = 7; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 8; -} - -// BoolRules describes the constraints applied to `bool` values -message BoolRules { - // Const specifies that this field must be exactly the specified value - optional bool const = 1; -} - -// StringRules describe the constraints applied to `string` values -message StringRules { - // Const specifies that this field must be exactly the specified value - optional string const = 1; - - // Len specifies that this field must be the specified number of - // characters (Unicode code points). Note that the number of - // characters may differ from the number of bytes in the string. - optional uint64 len = 19; - - // MinLen specifies that this field must be the specified number of - // characters (Unicode code points) at a minimum. Note that the number of - // characters may differ from the number of bytes in the string. - optional uint64 min_len = 2; - - // MaxLen specifies that this field must be the specified number of - // characters (Unicode code points) at a maximum. Note that the number of - // characters may differ from the number of bytes in the string. - optional uint64 max_len = 3; - - // LenBytes specifies that this field must be the specified number of bytes - optional uint64 len_bytes = 20; - - // MinBytes specifies that this field must be the specified number of bytes - // at a minimum - optional uint64 min_bytes = 4; - - // MaxBytes specifies that this field must be the specified number of bytes - // at a maximum - optional uint64 max_bytes = 5; - - // Pattern specifes that this field must match against the specified - // regular expression (RE2 syntax). The included expression should elide - // any delimiters. - optional string pattern = 6; - - // Prefix specifies that this field must have the specified substring at - // the beginning of the string. - optional string prefix = 7; - - // Suffix specifies that this field must have the specified substring at - // the end of the string. - optional string suffix = 8; - - // Contains specifies that this field must have the specified substring - // anywhere in the string. - optional string contains = 9; - - // NotContains specifies that this field cannot have the specified substring - // anywhere in the string. - optional string not_contains = 23; - - // In specifies that this field must be equal to one of the specified - // values - repeated string in = 10; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated string not_in = 11; - - // WellKnown rules provide advanced constraints against common string - // patterns - oneof well_known { - // Email specifies that the field must be a valid email address as - // defined by RFC 5322 - bool email = 12; - - // Hostname specifies that the field must be a valid hostname as - // defined by RFC 1034. This constraint does not support - // internationalized domain names (IDNs). - bool hostname = 13; - - // Ip specifies that the field must be a valid IP (v4 or v6) address. - // Valid IPv6 addresses should not include surrounding square brackets. - bool ip = 14; - - // Ipv4 specifies that the field must be a valid IPv4 address. - bool ipv4 = 15; - - // Ipv6 specifies that the field must be a valid IPv6 address. Valid - // IPv6 addresses should not include surrounding square brackets. - bool ipv6 = 16; - - // Uri specifies that the field must be a valid, absolute URI as defined - // by RFC 3986 - bool uri = 17; - - // UriRef specifies that the field must be a valid URI as defined by RFC - // 3986 and may be relative or absolute. - bool uri_ref = 18; - - // Address specifies that the field must be either a valid hostname as - // defined by RFC 1034 (which does not support internationalized domain - // names or IDNs), or it can be a valid IP (v4 or v6). - bool address = 21; - - // Uuid specifies that the field must be a valid UUID as defined by - // RFC 4122 - bool uuid = 22; - - // WellKnownRegex specifies a common well known pattern defined as a regex. - KnownRegex well_known_regex = 24; - } - - // This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable - // strict header validation. - // By default, this is true, and HTTP header validations are RFC-compliant. - // Setting to false will enable a looser validations that only disallows - // \r\n\0 characters, which can be used to bypass header matching rules. - optional bool strict = 25 [default = true]; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 26; -} - -// WellKnownRegex contain some well-known patterns. -enum KnownRegex { - UNKNOWN = 0; - - // HTTP header name as defined by RFC 7230. - HTTP_HEADER_NAME = 1; - - // HTTP header value as defined by RFC 7230. - HTTP_HEADER_VALUE = 2; -} - -// BytesRules describe the constraints applied to `bytes` values -message BytesRules { - // Const specifies that this field must be exactly the specified value - optional bytes const = 1; - - // Len specifies that this field must be the specified number of bytes - optional uint64 len = 13; - - // MinLen specifies that this field must be the specified number of bytes - // at a minimum - optional uint64 min_len = 2; - - // MaxLen specifies that this field must be the specified number of bytes - // at a maximum - optional uint64 max_len = 3; - - // Pattern specifes that this field must match against the specified - // regular expression (RE2 syntax). The included expression should elide - // any delimiters. - optional string pattern = 4; - - // Prefix specifies that this field must have the specified bytes at the - // beginning of the string. - optional bytes prefix = 5; - - // Suffix specifies that this field must have the specified bytes at the - // end of the string. - optional bytes suffix = 6; - - // Contains specifies that this field must have the specified bytes - // anywhere in the string. - optional bytes contains = 7; - - // In specifies that this field must be equal to one of the specified - // values - repeated bytes in = 8; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated bytes not_in = 9; - - // WellKnown rules provide advanced constraints against common byte - // patterns - oneof well_known { - // Ip specifies that the field must be a valid IP (v4 or v6) address in - // byte format - bool ip = 10; - - // Ipv4 specifies that the field must be a valid IPv4 address in byte - // format - bool ipv4 = 11; - - // Ipv6 specifies that the field must be a valid IPv6 address in byte - // format - bool ipv6 = 12; - } - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 14; -} - -// EnumRules describe the constraints applied to enum values -message EnumRules { - // Const specifies that this field must be exactly the specified value - optional int32 const = 1; - - // DefinedOnly specifies that this field must be only one of the defined - // values for this enum, failing on any undefined value. - optional bool defined_only = 2; - - // In specifies that this field must be equal to one of the specified - // values - repeated int32 in = 3; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated int32 not_in = 4; -} - -// MessageRules describe the constraints applied to embedded message values. -// For message-type fields, validation is performed recursively. -message MessageRules { - // Skip specifies that the validation rules of this field should not be - // evaluated - optional bool skip = 1; - - // Required specifies that this field must be set - optional bool required = 2; -} - -// RepeatedRules describe the constraints applied to `repeated` values -message RepeatedRules { - // MinItems specifies that this field must have the specified number of - // items at a minimum - optional uint64 min_items = 1; - - // MaxItems specifies that this field must have the specified number of - // items at a maximum - optional uint64 max_items = 2; - - // Unique specifies that all elements in this field must be unique. This - // contraint is only applicable to scalar and enum types (messages are not - // supported). - optional bool unique = 3; - - // Items specifies the contraints to be applied to each item in the field. - // Repeated message fields will still execute validation against each item - // unless skip is specified here. - optional FieldRules items = 4; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 5; -} - -// MapRules describe the constraints applied to `map` values -message MapRules { - // MinPairs specifies that this field must have the specified number of - // KVs at a minimum - optional uint64 min_pairs = 1; - - // MaxPairs specifies that this field must have the specified number of - // KVs at a maximum - optional uint64 max_pairs = 2; - - // NoSparse specifies values in this field cannot be unset. This only - // applies to map's with message value types. - optional bool no_sparse = 3; - - // Keys specifies the constraints to be applied to each key in the field. - optional FieldRules keys = 4; - - // Values specifies the constraints to be applied to the value of each key - // in the field. Message values will still have their validations evaluated - // unless skip is specified here. - optional FieldRules values = 5; - - // IgnoreEmpty specifies that the validation rules of this field should be - // evaluated only if the field is not empty - optional bool ignore_empty = 6; -} - -// AnyRules describe constraints applied exclusively to the -// `google.protobuf.Any` well-known type -message AnyRules { - // Required specifies that this field must be set - optional bool required = 1; - - // In specifies that this field's `type_url` must be equal to one of the - // specified values. - repeated string in = 2; - - // NotIn specifies that this field's `type_url` must not be equal to any of - // the specified values. - repeated string not_in = 3; -} - -// DurationRules describe the constraints applied exclusively to the -// `google.protobuf.Duration` well-known type -message DurationRules { - // Required specifies that this field must be set - optional bool required = 1; - - // Const specifies that this field must be exactly the specified value - optional google.protobuf.Duration const = 2; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional google.protobuf.Duration lt = 3; - - // Lt specifies that this field must be less than the specified value, - // inclusive - optional google.protobuf.Duration lte = 4; - - // Gt specifies that this field must be greater than the specified value, - // exclusive - optional google.protobuf.Duration gt = 5; - - // Gte specifies that this field must be greater than the specified value, - // inclusive - optional google.protobuf.Duration gte = 6; - - // In specifies that this field must be equal to one of the specified - // values - repeated google.protobuf.Duration in = 7; - - // NotIn specifies that this field cannot be equal to one of the specified - // values - repeated google.protobuf.Duration not_in = 8; -} - -// TimestampRules describe the constraints applied exclusively to the -// `google.protobuf.Timestamp` well-known type -message TimestampRules { - // Required specifies that this field must be set - optional bool required = 1; - - // Const specifies that this field must be exactly the specified value - optional google.protobuf.Timestamp const = 2; - - // Lt specifies that this field must be less than the specified value, - // exclusive - optional google.protobuf.Timestamp lt = 3; - - // Lte specifies that this field must be less than the specified value, - // inclusive - optional google.protobuf.Timestamp lte = 4; - - // Gt specifies that this field must be greater than the specified value, - // exclusive - optional google.protobuf.Timestamp gt = 5; - - // Gte specifies that this field must be greater than the specified value, - // inclusive - optional google.protobuf.Timestamp gte = 6; - - // LtNow specifies that this must be less than the current time. LtNow - // can only be used with the Within rule. - optional bool lt_now = 7; - - // GtNow specifies that this must be greater than the current time. GtNow - // can only be used with the Within rule. - optional bool gt_now = 8; - - // Within specifies that this field must be within this duration of the - // current time. This constraint can be used alone or with the LtNow and - // GtNow rules. - optional google.protobuf.Duration within = 9; -}