initial rewrite, use micro v4 and not cms-xxx stuff #4

Merged
vtolstov merged 24 commits from rewrite into master 2023-08-14 15:08:53 +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";
import "validate/validate.proto";
import "google/protobuf/wrappers.proto";
service DashboardService {
rpc ListPackage(ListPackageReq) returns (ListPackageRsp) {};
rpc UpdateInfo(UpdateInfoPackageRsp) returns (UpdateInfoPackageReq) {};
rpc UpdatePackage(UpdatePackageRsp) returns (UpdatePackageReq) {};
rpc AddComment(AddCommentRsp) returns (AddCommentReq) {};
rpc AddPackage(AddPackageRsp) returns (AddPackageReq) {};
};
@ -60,15 +61,19 @@ message ListPackageRsp{
repeated Package packages = 1;
}
message UpdateInfoPackageRsp {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
message UpdatePackageRsp {
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];
}
message AddCommentRsp {
uint64 idPackage = 1 [(validate.rules).uint64.gt = 0];
google.protobuf.UInt64Value idPackage = 1 [(validate.rules).message.required = true];
string text = 2;
}
@ -77,8 +82,8 @@ message AddCommentReq {
}
message AddPackageRsp {
string name = 1 [(validate.rules).string.min_len = 1];
string url = 2 [(validate.rules).string.min_len = 1];
google.protobuf.StringValue name = 1 [(validate.rules).message.required = true];
google.protobuf.StringValue url = 2 [(validate.rules).message.required = true];
repeated uint64 modules = 3;
}
message AddPackageReq{}

View File

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

View File

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

View File

@ -22,14 +22,14 @@ var (
type DashboardServiceClient interface {
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)
AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, opts ...client.CallOption) (*go_generate.AddPackageReq, error)
}
type DashboardServiceServer interface {
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
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
}
func (c *dashboardServiceClient) UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, opts ...client.CallOption) (*go_generate.UpdateInfoPackageReq, error) {
rsp := &go_generate.UpdateInfoPackageReq{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.UpdateInfo", req), rsp, opts...)
func (c *dashboardServiceClient) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, opts ...client.CallOption) (*go_generate.UpdatePackageReq, error) {
rsp := &go_generate.UpdatePackageReq{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.UpdatePackage", req), rsp, opts...)
if err != nil {
return nil, err
}
@ -66,8 +66,8 @@ func (h *dashboardServiceServer) ListPackage(ctx context.Context, req *go_genera
return h.DashboardServiceServer.ListPackage(ctx, req, rsp)
}
func (h *dashboardServiceServer) UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, rsp *go_generate.UpdateInfoPackageReq) error {
return h.DashboardServiceServer.UpdateInfo(ctx, req, rsp)
func (h *dashboardServiceServer) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, rsp *go_generate.UpdatePackageReq) error {
return h.DashboardServiceServer.UpdatePackage(ctx, req, rsp)
}
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 {
type dashboardService interface {
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
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 {
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 {
return err
}