add handlers, storage(Postgres, sqlite) #3

Merged
vtolstov merged 12 commits from devstigneev/pkgdash:master into master 2023-08-11 20:12:16 +03:00
7 changed files with 447 additions and 190 deletions
Showing only changes of commit 89522f28da - Show all commits

View File

@ -5,10 +5,11 @@ package proto;
option go_package = "go.unistack.org/unistack-org/pkgdash/proto/go_generate;go_generate"; option go_package = "go.unistack.org/unistack-org/pkgdash/proto/go_generate;go_generate";
import "validate/validate.proto"; import "validate/validate.proto";
import "google/protobuf/wrappers.proto";
service DashboardService { service DashboardService {
rpc ListPackage(ListPackageReq) returns (ListPackageRsp) {}; rpc ListPackage(ListPackageReq) returns (ListPackageRsp) {};
rpc UpdateInfo(UpdateInfoPackageRsp) returns (UpdateInfoPackageReq) {}; rpc UpdatePackage(UpdatePackageRsp) returns (UpdatePackageReq) {};
rpc AddComment(AddCommentRsp) returns (AddCommentReq) {}; rpc AddComment(AddCommentRsp) returns (AddCommentReq) {};
rpc AddPackage(AddPackageRsp) returns (AddPackageReq) {}; rpc AddPackage(AddPackageRsp) returns (AddPackageReq) {};
}; };
@ -60,15 +61,19 @@ message ListPackageRsp{
repeated Package packages = 1; repeated Package packages = 1;
} }
message UpdateInfoPackageRsp { message UpdatePackageRsp {
uint64 id = 1 [(validate.rules).uint64.gt = 0]; google.protobuf.UInt64Value id = 1 [(validate.rules).message.required = true];
google.protobuf.StringValue name = 2 [(validate.rules).message.required = true];
google.protobuf.StringValue url = 3 [(validate.rules).message.required = true];
repeated uint64 modules = 4 ;
repeated uint64 issues = 5 ;
} }
message UpdateInfoPackageReq { message UpdatePackageReq {
uint64 id = 1 [(validate.rules).uint64.gt = 0]; uint64 id = 1 [(validate.rules).uint64.gt = 0];
} }
message AddCommentRsp { message AddCommentRsp {
uint64 idPackage = 1 [(validate.rules).uint64.gt = 0]; google.protobuf.UInt64Value idPackage = 1 [(validate.rules).message.required = true];
string text = 2; string text = 2;
} }
@ -77,8 +82,8 @@ message AddCommentReq {
} }
message AddPackageRsp { message AddPackageRsp {
string name = 1 [(validate.rules).string.min_len = 1]; google.protobuf.StringValue name = 1 [(validate.rules).message.required = true];
string url = 2 [(validate.rules).string.min_len = 1]; google.protobuf.StringValue url = 2 [(validate.rules).message.required = true];
repeated uint64 modules = 3; repeated uint64 modules = 3;
} }
message AddPackageReq{} message AddPackageReq{}

View File

@ -8,7 +8,7 @@
--validate_out=paths=source_relative,lang=go:go_generate --validate_out=paths=source_relative,lang=go:go_generate
" "
find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" \) -delete find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" -or -name "Dockerfile" -or -name "Makefile" \) -delete
mkdir -p micro go_generate && \ mkdir -p micro go_generate && \
protoc -I. $PROTO_ARGS ./*.proto || \ protoc -I. $PROTO_ARGS ./*.proto || \
find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" \) -delete find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" -or -name "Dockerfile" -or -name "Makefile" \) -delete

View File

@ -10,6 +10,7 @@ import (
_ "github.com/envoyproxy/protoc-gen-validate/validate" _ "github.com/envoyproxy/protoc-gen-validate/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
) )
@ -532,16 +533,20 @@ func (x *ListPackageRsp) GetPackages() []*Package {
return nil return nil
} }
type UpdateInfoPackageRsp struct { type UpdatePackageRsp struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Id *wrapperspb.UInt64Value `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name *wrapperspb.StringValue `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Url *wrapperspb.StringValue `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
Modules []uint64 `protobuf:"varint,4,rep,packed,name=modules,proto3" json:"modules,omitempty"`
Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"`
} }
func (x *UpdateInfoPackageRsp) Reset() { func (x *UpdatePackageRsp) Reset() {
*x = UpdateInfoPackageRsp{} *x = UpdatePackageRsp{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[8] mi := &file_dashboard_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -549,13 +554,13 @@ func (x *UpdateInfoPackageRsp) Reset() {
} }
} }
func (x *UpdateInfoPackageRsp) String() string { func (x *UpdatePackageRsp) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*UpdateInfoPackageRsp) ProtoMessage() {} func (*UpdatePackageRsp) ProtoMessage() {}
func (x *UpdateInfoPackageRsp) ProtoReflect() protoreflect.Message { func (x *UpdatePackageRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[8] mi := &file_dashboard_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -567,19 +572,47 @@ func (x *UpdateInfoPackageRsp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use UpdateInfoPackageRsp.ProtoReflect.Descriptor instead. // Deprecated: Use UpdatePackageRsp.ProtoReflect.Descriptor instead.
func (*UpdateInfoPackageRsp) Descriptor() ([]byte, []int) { func (*UpdatePackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{8} return file_dashboard_proto_rawDescGZIP(), []int{8}
} }
func (x *UpdateInfoPackageRsp) GetId() uint64 { func (x *UpdatePackageRsp) GetId() *wrapperspb.UInt64Value {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return 0 return nil
} }
type UpdateInfoPackageReq struct { func (x *UpdatePackageRsp) GetName() *wrapperspb.StringValue {
if x != nil {
return x.Name
}
return nil
}
func (x *UpdatePackageRsp) GetUrl() *wrapperspb.StringValue {
if x != nil {
return x.Url
}
return nil
}
func (x *UpdatePackageRsp) GetModules() []uint64 {
if x != nil {
return x.Modules
}
return nil
}
func (x *UpdatePackageRsp) GetIssues() []uint64 {
if x != nil {
return x.Issues
}
return nil
}
type UpdatePackageReq struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -587,8 +620,8 @@ type UpdateInfoPackageReq struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
} }
func (x *UpdateInfoPackageReq) Reset() { func (x *UpdatePackageReq) Reset() {
*x = UpdateInfoPackageReq{} *x = UpdatePackageReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[9] mi := &file_dashboard_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -596,13 +629,13 @@ func (x *UpdateInfoPackageReq) Reset() {
} }
} }
func (x *UpdateInfoPackageReq) String() string { func (x *UpdatePackageReq) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*UpdateInfoPackageReq) ProtoMessage() {} func (*UpdatePackageReq) ProtoMessage() {}
func (x *UpdateInfoPackageReq) ProtoReflect() protoreflect.Message { func (x *UpdatePackageReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[9] mi := &file_dashboard_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -614,12 +647,12 @@ func (x *UpdateInfoPackageReq) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use UpdateInfoPackageReq.ProtoReflect.Descriptor instead. // Deprecated: Use UpdatePackageReq.ProtoReflect.Descriptor instead.
func (*UpdateInfoPackageReq) Descriptor() ([]byte, []int) { func (*UpdatePackageReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{9} return file_dashboard_proto_rawDescGZIP(), []int{9}
} }
func (x *UpdateInfoPackageReq) GetId() uint64 { func (x *UpdatePackageReq) GetId() uint64 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
@ -631,8 +664,8 @@ type AddCommentRsp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
IdPackage uint64 `protobuf:"varint,1,opt,name=idPackage,proto3" json:"idPackage,omitempty"` IdPackage *wrapperspb.UInt64Value `protobuf:"bytes,1,opt,name=idPackage,proto3" json:"idPackage,omitempty"`
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
} }
func (x *AddCommentRsp) Reset() { func (x *AddCommentRsp) Reset() {
@ -667,11 +700,11 @@ func (*AddCommentRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{10} return file_dashboard_proto_rawDescGZIP(), []int{10}
} }
func (x *AddCommentRsp) GetIdPackage() uint64 { func (x *AddCommentRsp) GetIdPackage() *wrapperspb.UInt64Value {
if x != nil { if x != nil {
return x.IdPackage return x.IdPackage
} }
return 0 return nil
} }
func (x *AddCommentRsp) GetText() string { func (x *AddCommentRsp) GetText() string {
@ -733,9 +766,9 @@ type AddPackageRsp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name *wrapperspb.StringValue `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` Url *wrapperspb.StringValue `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
Modules []uint64 `protobuf:"varint,3,rep,packed,name=modules,proto3" json:"modules,omitempty"` Modules []uint64 `protobuf:"varint,3,rep,packed,name=modules,proto3" json:"modules,omitempty"`
} }
func (x *AddPackageRsp) Reset() { func (x *AddPackageRsp) Reset() {
@ -770,18 +803,18 @@ func (*AddPackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{12} return file_dashboard_proto_rawDescGZIP(), []int{12}
} }
func (x *AddPackageRsp) GetName() string { func (x *AddPackageRsp) GetName() *wrapperspb.StringValue {
if x != nil { if x != nil {
return x.Name return x.Name
} }
return "" return nil
} }
func (x *AddPackageRsp) GetUrl() string { func (x *AddPackageRsp) GetUrl() *wrapperspb.StringValue {
if x != nil { if x != nil {
return x.Url return x.Url
} }
return "" return nil
} }
func (x *AddPackageRsp) GetModules() []uint64 { func (x *AddPackageRsp) GetModules() []uint64 {
@ -835,6 +868,8 @@ var file_dashboard_proto_rawDesc = []byte{
0x0a, 0x0f, 0x64, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x0a, 0x0f, 0x64, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x6f, 0x12, 0x05, 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, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x2e, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x6f, 0x22, 0x2e, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0x12, 0x22, 0x0a,
0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f,
@ -888,50 +923,67 @@ var file_dashboard_proto_rawDesc = []byte{
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x72, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x08, 0x70, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, 0x2f, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, 0xf2, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x6e, 0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x02, 0x69, 0x64,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2f, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56,
0x49, 0x6e, 0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x17, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x02,
0x69, 0x64, 0x12, 0x3a, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08,
0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38,
0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74,
0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01,
0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03,
0x28, 0x04, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x10, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x17,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32,
0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4a, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x69, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f,
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x09, 0x69, 0x64, 0x50, 0x61, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x64, 0x50, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f,
0x32, 0x02, 0x20, 0x00, 0x52, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49,
0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01,
0x65, 0x78, 0x74, 0x22, 0x28, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x02, 0x10, 0x01, 0x52, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12,
0x74, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65,
0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x61, 0x0a, 0x78, 0x74, 0x22, 0x28, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x1b, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x9f, 0x01, 0x0a,
0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x3a,
0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67,
0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53,
0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a,
0x22, 0x0f, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x03, 0x75, 0x72,
0x71, 0x32, 0x93, 0x02, 0x0a, 0x10, 0x44, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x53, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52,
0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18,
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x0f,
0x52, 0x73, 0x70, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x32,
0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x8e, 0x02, 0x0a, 0x10, 0x44, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x53, 0x65, 0x72,
0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b,
0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x61, 0x67, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74,
0x6e, 0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x22, 0x00, 0x12, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f,
0x3a, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x2e, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63,
0x52, 0x73, 0x70, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64,
0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a, 0x41, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x1a, 0x17, 0x2e,
0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b,
0x6f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x1a, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43,
0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41,
0x67, 0x65, 0x52, 0x65, 0x71, 0x22, 0x00, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x1a, 0x14, 0x2e, 0x70,
0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52,
0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2f, 0x65, 0x71, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x67, 0x65, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61,
0x65, 0x3b, 0x67, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x22, 0x00,
0x42, 0x44, 0x5a, 0x42, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e,
0x6f, 0x72, 0x67, 0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67,
0x2f, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67,
0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x3b, 0x67, 0x6f, 0x5f, 0x67, 0x65,
0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -948,39 +1000,47 @@ func file_dashboard_proto_rawDescGZIP() []byte {
var file_dashboard_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_dashboard_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_dashboard_proto_goTypes = []interface{}{ var file_dashboard_proto_goTypes = []interface{}{
(*ErrorRsp)(nil), // 0: proto.ErrorRsp (*ErrorRsp)(nil), // 0: proto.ErrorRsp
(*Error)(nil), // 1: proto.Error (*Error)(nil), // 1: proto.Error
(*Package)(nil), // 2: proto.Package (*Package)(nil), // 2: proto.Package
(*Module)(nil), // 3: proto.Module (*Module)(nil), // 3: proto.Module
(*Issue)(nil), // 4: proto.Issue (*Issue)(nil), // 4: proto.Issue
(*Comment)(nil), // 5: proto.Comment (*Comment)(nil), // 5: proto.Comment
(*ListPackageReq)(nil), // 6: proto.ListPackageReq (*ListPackageReq)(nil), // 6: proto.ListPackageReq
(*ListPackageRsp)(nil), // 7: proto.ListPackageRsp (*ListPackageRsp)(nil), // 7: proto.ListPackageRsp
(*UpdateInfoPackageRsp)(nil), // 8: proto.UpdateInfoPackageRsp (*UpdatePackageRsp)(nil), // 8: proto.UpdatePackageRsp
(*UpdateInfoPackageReq)(nil), // 9: proto.UpdateInfoPackageReq (*UpdatePackageReq)(nil), // 9: proto.UpdatePackageReq
(*AddCommentRsp)(nil), // 10: proto.AddCommentRsp (*AddCommentRsp)(nil), // 10: proto.AddCommentRsp
(*AddCommentReq)(nil), // 11: proto.AddCommentReq (*AddCommentReq)(nil), // 11: proto.AddCommentReq
(*AddPackageRsp)(nil), // 12: proto.AddPackageRsp (*AddPackageRsp)(nil), // 12: proto.AddPackageRsp
(*AddPackageReq)(nil), // 13: proto.AddPackageReq (*AddPackageReq)(nil), // 13: proto.AddPackageReq
(*wrapperspb.UInt64Value)(nil), // 14: google.protobuf.UInt64Value
(*wrapperspb.StringValue)(nil), // 15: google.protobuf.StringValue
} }
var file_dashboard_proto_depIdxs = []int32{ var file_dashboard_proto_depIdxs = []int32{
1, // 0: proto.ErrorRsp.error:type_name -> proto.Error 1, // 0: proto.ErrorRsp.error:type_name -> proto.Error
3, // 1: proto.Package.modules:type_name -> proto.Module 3, // 1: proto.Package.modules:type_name -> proto.Module
4, // 2: proto.Package.issues:type_name -> proto.Issue 4, // 2: proto.Package.issues:type_name -> proto.Issue
2, // 3: proto.ListPackageRsp.packages:type_name -> proto.Package 2, // 3: proto.ListPackageRsp.packages:type_name -> proto.Package
6, // 4: proto.DashboardService.ListPackage:input_type -> proto.ListPackageReq 14, // 4: proto.UpdatePackageRsp.id:type_name -> google.protobuf.UInt64Value
8, // 5: proto.DashboardService.UpdateInfo:input_type -> proto.UpdateInfoPackageRsp 15, // 5: proto.UpdatePackageRsp.name:type_name -> google.protobuf.StringValue
10, // 6: proto.DashboardService.AddComment:input_type -> proto.AddCommentRsp 15, // 6: proto.UpdatePackageRsp.url:type_name -> google.protobuf.StringValue
12, // 7: proto.DashboardService.AddPackage:input_type -> proto.AddPackageRsp 14, // 7: proto.AddCommentRsp.idPackage:type_name -> google.protobuf.UInt64Value
7, // 8: proto.DashboardService.ListPackage:output_type -> proto.ListPackageRsp 15, // 8: proto.AddPackageRsp.name:type_name -> google.protobuf.StringValue
9, // 9: proto.DashboardService.UpdateInfo:output_type -> proto.UpdateInfoPackageReq 15, // 9: proto.AddPackageRsp.url:type_name -> google.protobuf.StringValue
11, // 10: proto.DashboardService.AddComment:output_type -> proto.AddCommentReq 6, // 10: proto.DashboardService.ListPackage:input_type -> proto.ListPackageReq
13, // 11: proto.DashboardService.AddPackage:output_type -> proto.AddPackageReq 8, // 11: proto.DashboardService.UpdatePackage:input_type -> proto.UpdatePackageRsp
8, // [8:12] is the sub-list for method output_type 10, // 12: proto.DashboardService.AddComment:input_type -> proto.AddCommentRsp
4, // [4:8] is the sub-list for method input_type 12, // 13: proto.DashboardService.AddPackage:input_type -> proto.AddPackageRsp
4, // [4:4] is the sub-list for extension type_name 7, // 14: proto.DashboardService.ListPackage:output_type -> proto.ListPackageRsp
4, // [4:4] is the sub-list for extension extendee 9, // 15: proto.DashboardService.UpdatePackage:output_type -> proto.UpdatePackageReq
0, // [0:4] is the sub-list for field type_name 11, // 16: proto.DashboardService.AddComment:output_type -> proto.AddCommentReq
13, // 17: proto.DashboardService.AddPackage:output_type -> proto.AddPackageReq
14, // [14:18] is the sub-list for method output_type
10, // [10:14] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
} }
func init() { file_dashboard_proto_init() } func init() { file_dashboard_proto_init() }
@ -1086,7 +1146,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateInfoPackageRsp); i { switch v := v.(*UpdatePackageRsp); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1098,7 +1158,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateInfoPackageReq); i { switch v := v.(*UpdatePackageReq); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:

View File

@ -1130,32 +1130,32 @@ var _ interface {
ErrorName() string ErrorName() string
} = ListPackageRspValidationError{} } = ListPackageRspValidationError{}
// Validate checks the field values on UpdateInfoPackageRsp with the rules // Validate checks the field values on UpdatePackageRsp with the rules defined
// defined in the proto definition for this message. If any rules are // in the proto definition for this message. If any rules are violated, the
// violated, the first error encountered is returned, or nil if there are no violations. // first error encountered is returned, or nil if there are no violations.
func (m *UpdateInfoPackageRsp) Validate() error { func (m *UpdatePackageRsp) Validate() error {
return m.validate(false) return m.validate(false)
} }
// ValidateAll checks the field values on UpdateInfoPackageRsp with the rules // ValidateAll checks the field values on UpdatePackageRsp with the rules
// defined in the proto definition for this message. If any rules are // defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in // violated, the result is a list of violation errors wrapped in
// UpdateInfoPackageRspMultiError, or nil if none found. // UpdatePackageRspMultiError, or nil if none found.
func (m *UpdateInfoPackageRsp) ValidateAll() error { func (m *UpdatePackageRsp) ValidateAll() error {
return m.validate(true) return m.validate(true)
} }
func (m *UpdateInfoPackageRsp) validate(all bool) error { func (m *UpdatePackageRsp) validate(all bool) error {
if m == nil { if m == nil {
return nil return nil
} }
var errors []error var errors []error
if m.GetId() <= 0 { if m.GetId() == nil {
err := UpdateInfoPackageRspValidationError{ err := UpdatePackageRspValidationError{
field: "Id", field: "Id",
reason: "value must be greater than 0", reason: "value is required",
} }
if !all { if !all {
return err return err
@ -1163,20 +1163,129 @@ func (m *UpdateInfoPackageRsp) validate(all bool) error {
errors = append(errors, err) errors = append(errors, err)
} }
if all {
switch v := interface{}(m.GetId()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdatePackageRspValidationError{
field: "Id",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdatePackageRspValidationError{
field: "Id",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetId()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdatePackageRspValidationError{
field: "Id",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.GetName() == nil {
err := UpdatePackageRspValidationError{
field: "Name",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetName()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdatePackageRspValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdatePackageRspValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdatePackageRspValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.GetUrl() == nil {
err := UpdatePackageRspValidationError{
field: "Url",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetUrl()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdatePackageRspValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdatePackageRspValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetUrl()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdatePackageRspValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 { if len(errors) > 0 {
return UpdateInfoPackageRspMultiError(errors) return UpdatePackageRspMultiError(errors)
} }
return nil return nil
} }
// UpdateInfoPackageRspMultiError is an error wrapping multiple validation // UpdatePackageRspMultiError is an error wrapping multiple validation errors
// errors returned by UpdateInfoPackageRsp.ValidateAll() if the designated // returned by UpdatePackageRsp.ValidateAll() if the designated constraints
// constraints aren't met. // aren't met.
type UpdateInfoPackageRspMultiError []error type UpdatePackageRspMultiError []error
// Error returns a concatenation of all the error messages it wraps. // Error returns a concatenation of all the error messages it wraps.
func (m UpdateInfoPackageRspMultiError) Error() string { func (m UpdatePackageRspMultiError) Error() string {
var msgs []string var msgs []string
for _, err := range m { for _, err := range m {
msgs = append(msgs, err.Error()) msgs = append(msgs, err.Error())
@ -1185,11 +1294,11 @@ func (m UpdateInfoPackageRspMultiError) Error() string {
} }
// AllErrors returns a list of validation violation errors. // AllErrors returns a list of validation violation errors.
func (m UpdateInfoPackageRspMultiError) AllErrors() []error { return m } func (m UpdatePackageRspMultiError) AllErrors() []error { return m }
// UpdateInfoPackageRspValidationError is the validation error returned by // UpdatePackageRspValidationError is the validation error returned by
// UpdateInfoPackageRsp.Validate if the designated constraints aren't met. // UpdatePackageRsp.Validate if the designated constraints aren't met.
type UpdateInfoPackageRspValidationError struct { type UpdatePackageRspValidationError struct {
field string field string
reason string reason string
cause error cause error
@ -1197,24 +1306,22 @@ type UpdateInfoPackageRspValidationError struct {
} }
// Field function returns field value. // Field function returns field value.
func (e UpdateInfoPackageRspValidationError) Field() string { return e.field } func (e UpdatePackageRspValidationError) Field() string { return e.field }
// Reason function returns reason value. // Reason function returns reason value.
func (e UpdateInfoPackageRspValidationError) Reason() string { return e.reason } func (e UpdatePackageRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value. // Cause function returns cause value.
func (e UpdateInfoPackageRspValidationError) Cause() error { return e.cause } func (e UpdatePackageRspValidationError) Cause() error { return e.cause }
// Key function returns key value. // Key function returns key value.
func (e UpdateInfoPackageRspValidationError) Key() bool { return e.key } func (e UpdatePackageRspValidationError) Key() bool { return e.key }
// ErrorName returns error name. // ErrorName returns error name.
func (e UpdateInfoPackageRspValidationError) ErrorName() string { func (e UpdatePackageRspValidationError) ErrorName() string { return "UpdatePackageRspValidationError" }
return "UpdateInfoPackageRspValidationError"
}
// Error satisfies the builtin error interface // Error satisfies the builtin error interface
func (e UpdateInfoPackageRspValidationError) Error() string { func (e UpdatePackageRspValidationError) Error() string {
cause := "" cause := ""
if e.cause != nil { if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause) cause = fmt.Sprintf(" | caused by: %v", e.cause)
@ -1226,14 +1333,14 @@ func (e UpdateInfoPackageRspValidationError) Error() string {
} }
return fmt.Sprintf( return fmt.Sprintf(
"invalid %sUpdateInfoPackageRsp.%s: %s%s", "invalid %sUpdatePackageRsp.%s: %s%s",
key, key,
e.field, e.field,
e.reason, e.reason,
cause) cause)
} }
var _ error = UpdateInfoPackageRspValidationError{} var _ error = UpdatePackageRspValidationError{}
var _ interface { var _ interface {
Field() string Field() string
@ -1241,24 +1348,24 @@ var _ interface {
Key() bool Key() bool
Cause() error Cause() error
ErrorName() string ErrorName() string
} = UpdateInfoPackageRspValidationError{} } = UpdatePackageRspValidationError{}
// Validate checks the field values on UpdateInfoPackageReq with the rules // Validate checks the field values on UpdatePackageReq with the rules defined
// defined in the proto definition for this message. If any rules are // in the proto definition for this message. If any rules are violated, the
// violated, the first error encountered is returned, or nil if there are no violations. // first error encountered is returned, or nil if there are no violations.
func (m *UpdateInfoPackageReq) Validate() error { func (m *UpdatePackageReq) Validate() error {
return m.validate(false) return m.validate(false)
} }
// ValidateAll checks the field values on UpdateInfoPackageReq with the rules // ValidateAll checks the field values on UpdatePackageReq with the rules
// defined in the proto definition for this message. If any rules are // defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in // violated, the result is a list of violation errors wrapped in
// UpdateInfoPackageReqMultiError, or nil if none found. // UpdatePackageReqMultiError, or nil if none found.
func (m *UpdateInfoPackageReq) ValidateAll() error { func (m *UpdatePackageReq) ValidateAll() error {
return m.validate(true) return m.validate(true)
} }
func (m *UpdateInfoPackageReq) validate(all bool) error { func (m *UpdatePackageReq) validate(all bool) error {
if m == nil { if m == nil {
return nil return nil
} }
@ -1266,7 +1373,7 @@ func (m *UpdateInfoPackageReq) validate(all bool) error {
var errors []error var errors []error
if m.GetId() <= 0 { if m.GetId() <= 0 {
err := UpdateInfoPackageReqValidationError{ err := UpdatePackageReqValidationError{
field: "Id", field: "Id",
reason: "value must be greater than 0", reason: "value must be greater than 0",
} }
@ -1277,19 +1384,19 @@ func (m *UpdateInfoPackageReq) validate(all bool) error {
} }
if len(errors) > 0 { if len(errors) > 0 {
return UpdateInfoPackageReqMultiError(errors) return UpdatePackageReqMultiError(errors)
} }
return nil return nil
} }
// UpdateInfoPackageReqMultiError is an error wrapping multiple validation // UpdatePackageReqMultiError is an error wrapping multiple validation errors
// errors returned by UpdateInfoPackageReq.ValidateAll() if the designated // returned by UpdatePackageReq.ValidateAll() if the designated constraints
// constraints aren't met. // aren't met.
type UpdateInfoPackageReqMultiError []error type UpdatePackageReqMultiError []error
// Error returns a concatenation of all the error messages it wraps. // Error returns a concatenation of all the error messages it wraps.
func (m UpdateInfoPackageReqMultiError) Error() string { func (m UpdatePackageReqMultiError) Error() string {
var msgs []string var msgs []string
for _, err := range m { for _, err := range m {
msgs = append(msgs, err.Error()) msgs = append(msgs, err.Error())
@ -1298,11 +1405,11 @@ func (m UpdateInfoPackageReqMultiError) Error() string {
} }
// AllErrors returns a list of validation violation errors. // AllErrors returns a list of validation violation errors.
func (m UpdateInfoPackageReqMultiError) AllErrors() []error { return m } func (m UpdatePackageReqMultiError) AllErrors() []error { return m }
// UpdateInfoPackageReqValidationError is the validation error returned by // UpdatePackageReqValidationError is the validation error returned by
// UpdateInfoPackageReq.Validate if the designated constraints aren't met. // UpdatePackageReq.Validate if the designated constraints aren't met.
type UpdateInfoPackageReqValidationError struct { type UpdatePackageReqValidationError struct {
field string field string
reason string reason string
cause error cause error
@ -1310,24 +1417,22 @@ type UpdateInfoPackageReqValidationError struct {
} }
// Field function returns field value. // Field function returns field value.
func (e UpdateInfoPackageReqValidationError) Field() string { return e.field } func (e UpdatePackageReqValidationError) Field() string { return e.field }
// Reason function returns reason value. // Reason function returns reason value.
func (e UpdateInfoPackageReqValidationError) Reason() string { return e.reason } func (e UpdatePackageReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value. // Cause function returns cause value.
func (e UpdateInfoPackageReqValidationError) Cause() error { return e.cause } func (e UpdatePackageReqValidationError) Cause() error { return e.cause }
// Key function returns key value. // Key function returns key value.
func (e UpdateInfoPackageReqValidationError) Key() bool { return e.key } func (e UpdatePackageReqValidationError) Key() bool { return e.key }
// ErrorName returns error name. // ErrorName returns error name.
func (e UpdateInfoPackageReqValidationError) ErrorName() string { func (e UpdatePackageReqValidationError) ErrorName() string { return "UpdatePackageReqValidationError" }
return "UpdateInfoPackageReqValidationError"
}
// Error satisfies the builtin error interface // Error satisfies the builtin error interface
func (e UpdateInfoPackageReqValidationError) Error() string { func (e UpdatePackageReqValidationError) Error() string {
cause := "" cause := ""
if e.cause != nil { if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause) cause = fmt.Sprintf(" | caused by: %v", e.cause)
@ -1339,14 +1444,14 @@ func (e UpdateInfoPackageReqValidationError) Error() string {
} }
return fmt.Sprintf( return fmt.Sprintf(
"invalid %sUpdateInfoPackageReq.%s: %s%s", "invalid %sUpdatePackageReq.%s: %s%s",
key, key,
e.field, e.field,
e.reason, e.reason,
cause) cause)
} }
var _ error = UpdateInfoPackageReqValidationError{} var _ error = UpdatePackageReqValidationError{}
var _ interface { var _ interface {
Field() string Field() string
@ -1354,7 +1459,7 @@ var _ interface {
Key() bool Key() bool
Cause() error Cause() error
ErrorName() string ErrorName() string
} = UpdateInfoPackageReqValidationError{} } = UpdatePackageReqValidationError{}
// Validate checks the field values on AddCommentRsp with the rules defined in // Validate checks the field values on AddCommentRsp with the rules defined in
// the proto definition for this message. If any rules are violated, the first // the proto definition for this message. If any rules are violated, the first
@ -1378,10 +1483,10 @@ func (m *AddCommentRsp) validate(all bool) error {
var errors []error var errors []error
if m.GetIdPackage() <= 0 { if m.GetIdPackage() == nil {
err := AddCommentRspValidationError{ err := AddCommentRspValidationError{
field: "IdPackage", field: "IdPackage",
reason: "value must be greater than 0", reason: "value is required",
} }
if !all { if !all {
return err return err
@ -1389,6 +1494,35 @@ func (m *AddCommentRsp) validate(all bool) error {
errors = append(errors, err) errors = append(errors, err)
} }
if all {
switch v := interface{}(m.GetIdPackage()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AddCommentRspValidationError{
field: "IdPackage",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AddCommentRspValidationError{
field: "IdPackage",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetIdPackage()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AddCommentRspValidationError{
field: "IdPackage",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for Text // no validation rules for Text
if len(errors) > 0 { if len(errors) > 0 {
@ -1602,10 +1736,10 @@ func (m *AddPackageRsp) validate(all bool) error {
var errors []error var errors []error
if utf8.RuneCountInString(m.GetName()) < 1 { if m.GetName() == nil {
err := AddPackageRspValidationError{ err := AddPackageRspValidationError{
field: "Name", field: "Name",
reason: "value length must be at least 1 runes", reason: "value is required",
} }
if !all { if !all {
return err return err
@ -1613,10 +1747,39 @@ func (m *AddPackageRsp) validate(all bool) error {
errors = append(errors, err) errors = append(errors, err)
} }
if utf8.RuneCountInString(m.GetUrl()) < 1 { if all {
switch v := interface{}(m.GetName()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AddPackageRspValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AddPackageRspValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AddPackageRspValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.GetUrl() == nil {
err := AddPackageRspValidationError{ err := AddPackageRspValidationError{
field: "Url", field: "Url",
reason: "value length must be at least 1 runes", reason: "value is required",
} }
if !all { if !all {
return err return err
@ -1624,6 +1787,35 @@ func (m *AddPackageRsp) validate(all bool) error {
errors = append(errors, err) errors = append(errors, err)
} }
if all {
switch v := interface{}(m.GetUrl()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AddPackageRspValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AddPackageRspValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetUrl()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AddPackageRspValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 { if len(errors) > 0 {
return AddPackageRspMultiError(errors) return AddPackageRspMultiError(errors)
} }

View File

@ -22,14 +22,14 @@ var (
type DashboardServiceClient interface { type DashboardServiceClient interface {
ListPackage(ctx context.Context, req *go_generate.ListPackageReq, opts ...client.CallOption) (*go_generate.ListPackageRsp, error) ListPackage(ctx context.Context, req *go_generate.ListPackageReq, opts ...client.CallOption) (*go_generate.ListPackageRsp, error)
UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, opts ...client.CallOption) (*go_generate.UpdateInfoPackageReq, error) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, opts ...client.CallOption) (*go_generate.UpdatePackageReq, error)
AddComment(ctx context.Context, req *go_generate.AddCommentRsp, opts ...client.CallOption) (*go_generate.AddCommentReq, error) AddComment(ctx context.Context, req *go_generate.AddCommentRsp, opts ...client.CallOption) (*go_generate.AddCommentReq, error)
AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, opts ...client.CallOption) (*go_generate.AddPackageReq, error) AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, opts ...client.CallOption) (*go_generate.AddPackageReq, error)
} }
type DashboardServiceServer interface { type DashboardServiceServer interface {
ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error
UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, rsp *go_generate.UpdateInfoPackageReq) error UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, rsp *go_generate.UpdatePackageReq) error
AddComment(ctx context.Context, req *go_generate.AddCommentRsp, rsp *go_generate.AddCommentReq) error AddComment(ctx context.Context, req *go_generate.AddCommentRsp, rsp *go_generate.AddCommentReq) error
AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, rsp *go_generate.AddPackageReq) error AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, rsp *go_generate.AddPackageReq) error
} }

View File

@ -31,9 +31,9 @@ func (c *dashboardServiceClient) ListPackage(ctx context.Context, req *go_genera
return rsp, nil return rsp, nil
} }
func (c *dashboardServiceClient) UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, opts ...client.CallOption) (*go_generate.UpdateInfoPackageReq, error) { func (c *dashboardServiceClient) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, opts ...client.CallOption) (*go_generate.UpdatePackageReq, error) {
rsp := &go_generate.UpdateInfoPackageReq{} rsp := &go_generate.UpdatePackageReq{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.UpdateInfo", req), rsp, opts...) err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.UpdatePackage", req), rsp, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -66,8 +66,8 @@ func (h *dashboardServiceServer) ListPackage(ctx context.Context, req *go_genera
return h.DashboardServiceServer.ListPackage(ctx, req, rsp) return h.DashboardServiceServer.ListPackage(ctx, req, rsp)
} }
func (h *dashboardServiceServer) UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, rsp *go_generate.UpdateInfoPackageReq) error { func (h *dashboardServiceServer) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, rsp *go_generate.UpdatePackageReq) error {
return h.DashboardServiceServer.UpdateInfo(ctx, req, rsp) return h.DashboardServiceServer.UpdatePackage(ctx, req, rsp)
} }
func (h *dashboardServiceServer) AddComment(ctx context.Context, req *go_generate.AddCommentRsp, rsp *go_generate.AddCommentReq) error { func (h *dashboardServiceServer) AddComment(ctx context.Context, req *go_generate.AddCommentRsp, rsp *go_generate.AddCommentReq) error {
@ -81,7 +81,7 @@ func (h *dashboardServiceServer) AddPackage(ctx context.Context, req *go_generat
func RegisterDashboardServiceServer(s server.Server, sh DashboardServiceServer, opts ...server.HandlerOption) error { func RegisterDashboardServiceServer(s server.Server, sh DashboardServiceServer, opts ...server.HandlerOption) error {
type dashboardService interface { type dashboardService interface {
ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error
UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, rsp *go_generate.UpdateInfoPackageReq) error UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, rsp *go_generate.UpdatePackageReq) error
AddComment(ctx context.Context, req *go_generate.AddCommentRsp, rsp *go_generate.AddCommentReq) error AddComment(ctx context.Context, req *go_generate.AddCommentRsp, rsp *go_generate.AddCommentReq) error
AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, rsp *go_generate.AddPackageReq) error AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, rsp *go_generate.AddPackageReq) error
} }

View File

@ -132,7 +132,7 @@ func (s *Postgres) AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error
} }
}() }()
res, err := tx.ExecContext(ctx, queryAddComment, rsp.Text, rsp.IdPackage) res, err := tx.ExecContext(ctx, queryAddComment, rsp.Text, rsp.IdPackage.Value)
if err != nil { if err != nil {
return err return err
} }
@ -162,7 +162,7 @@ func (s *Postgres) AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error
} }
}() }()
res, err := tx.ExecContext(ctx, queryAddPackage, rsp.Name, rsp.Url, pq.Array(rsp.Modules)) res, err := tx.ExecContext(ctx, queryAddPackage, rsp.Name.Value, rsp.Url.Value, pq.Array(rsp.Modules))
if err != nil { if err != nil {
return err return err
} }