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
13 changed files with 1090 additions and 680 deletions
Showing only changes of commit c1f1e31569 - Show all commits

View File

@ -24,7 +24,7 @@ type Handler struct {
protojson.UnmarshalOptions
git cligit.Client
chanUrl chan *pb.AddPackageRsp
chanUrl chan *pb.AddPackageReq
}
func (h *Handler) ListPackage(w http.ResponseWriter, r *http.Request) {
@ -59,20 +59,20 @@ func (h *Handler) UpdatePackage(w http.ResponseWriter, r *http.Request) {
return
}
rsp := new(pb.UpdatePackageRsp)
if err = h.Unmarshal(all, rsp); err != nil {
req := new(pb.UpdatePackageReq)
if err = h.Unmarshal(all, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewUnmarshalError(err))
return
}
if err = rsp.Validate(); err != nil {
if err = req.Validate(); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewValidationError(err))
return
}
if err = h.store.UpdatePackage(ctx, rsp); err != nil {
if err = h.store.UpdatePackage(ctx, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
@ -94,20 +94,20 @@ func (h *Handler) AddComment(w http.ResponseWriter, r *http.Request) {
return
}
rsp := new(pb.AddCommentRsp)
if err = h.Unmarshal(all, rsp); err != nil {
req := new(pb.AddCommentReq)
if err = h.Unmarshal(all, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewUnmarshalError(err))
return
}
if err = rsp.Validate(); err != nil {
if err = req.Validate(); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewValidationError(err))
return
}
if err = h.store.AddComment(ctx, rsp); err != nil {
if err = h.store.AddComment(ctx, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
@ -129,7 +129,7 @@ func (h *Handler) AddPackage(w http.ResponseWriter, r *http.Request) {
return
}
req := new(pb.AddPackageRsp)
req := new(pb.AddPackageReq)
if err = h.Unmarshal(all, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewUnmarshalError(err))
@ -151,6 +151,14 @@ func (h *Handler) AddPackage(w http.ResponseWriter, r *http.Request) {
logger.Debug(ctx, "Success finish addPackage")
}
func (h *Handler) GetModule(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
logger := h.svc.Logger()
logger.Debug(ctx, "Start GetModule")
//rsp := new(pb.GetModuleRsp)
}
func NewHandler(svc micro.Service, w writer, client cligit.Client) *Handler {
h := &Handler{
svc: svc,

View File

@ -9,9 +9,10 @@ import "google/protobuf/wrappers.proto";
service DashboardService {
rpc ListPackage(ListPackageReq) returns (ListPackageRsp) {};
rpc UpdatePackage(UpdatePackageRsp) returns (UpdatePackageReq) {};
rpc AddComment(AddCommentRsp) returns (AddCommentReq) {};
rpc AddPackage(AddPackageRsp) returns (AddPackageReq) {};
rpc UpdatePackage(UpdatePackageReq) returns (UpdatePackageRsp) {};
rpc AddComment(AddCommentReq) returns (AddCommentRsp) {};
rpc AddPackage(AddPackageReq) returns (AddPackageRsp) {};
rpc GetModule(GetModuleReq) returns (GetModuleRsp) {};
};
message ErrorRsp {
@ -62,29 +63,36 @@ message ListPackageRsp{
repeated Package packages = 1;
}
message UpdatePackageRsp {
message UpdatePackageReq {
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 UpdatePackageReq {
message UpdatePackageRsp {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
}
message AddCommentRsp {
message AddCommentReq {
google.protobuf.UInt64Value idPackage = 1 [(validate.rules).message.required = true];
string text = 2;
}
message AddCommentReq {
message AddCommentRsp {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
}
message AddPackageRsp {
message AddPackageReq {
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{}
message AddPackageRsp{}
message GetModuleReq {
repeated uint64 modules_id = 1 ;
}
message GetModuleRsp {
repeated Module modules = 1 ;
}

View File

@ -541,7 +541,7 @@ func (x *ListPackageRsp) GetPackages() []*Package {
return nil
}
type UpdatePackageRsp struct {
type UpdatePackageReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -553,85 +553,10 @@ type UpdatePackageRsp struct {
Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"`
}
func (x *UpdatePackageRsp) Reset() {
*x = UpdatePackageRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdatePackageRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdatePackageRsp) ProtoMessage() {}
func (x *UpdatePackageRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdatePackageRsp.ProtoReflect.Descriptor instead.
func (*UpdatePackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{8}
}
func (x *UpdatePackageRsp) GetId() *wrapperspb.UInt64Value {
if x != nil {
return x.Id
}
return nil
}
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
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *UpdatePackageReq) Reset() {
*x = UpdatePackageReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[9]
mi := &file_dashboard_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -644,7 +569,7 @@ func (x *UpdatePackageReq) String() string {
func (*UpdatePackageReq) ProtoMessage() {}
func (x *UpdatePackageReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[9]
mi := &file_dashboard_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -657,42 +582,69 @@ func (x *UpdatePackageReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdatePackageReq.ProtoReflect.Descriptor instead.
func (*UpdatePackageReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{9}
return file_dashboard_proto_rawDescGZIP(), []int{8}
}
func (x *UpdatePackageReq) GetId() uint64 {
func (x *UpdatePackageReq) GetId() *wrapperspb.UInt64Value {
if x != nil {
return x.Id
}
return 0
return nil
}
type AddCommentRsp struct {
func (x *UpdatePackageReq) GetName() *wrapperspb.StringValue {
if x != nil {
return x.Name
}
return nil
}
func (x *UpdatePackageReq) GetUrl() *wrapperspb.StringValue {
if x != nil {
return x.Url
}
return nil
}
func (x *UpdatePackageReq) GetModules() []uint64 {
if x != nil {
return x.Modules
}
return nil
}
func (x *UpdatePackageReq) GetIssues() []uint64 {
if x != nil {
return x.Issues
}
return nil
}
type UpdatePackageRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"`
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *AddCommentRsp) Reset() {
*x = AddCommentRsp{}
func (x *UpdatePackageRsp) Reset() {
*x = UpdatePackageRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[10]
mi := &file_dashboard_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddCommentRsp) String() string {
func (x *UpdatePackageRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddCommentRsp) ProtoMessage() {}
func (*UpdatePackageRsp) ProtoMessage() {}
func (x *AddCommentRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[10]
func (x *UpdatePackageRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -703,23 +655,16 @@ func (x *AddCommentRsp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use AddCommentRsp.ProtoReflect.Descriptor instead.
func (*AddCommentRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{10}
// Deprecated: Use UpdatePackageRsp.ProtoReflect.Descriptor instead.
func (*UpdatePackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{9}
}
func (x *AddCommentRsp) GetIdPackage() *wrapperspb.UInt64Value {
func (x *UpdatePackageRsp) GetId() uint64 {
if x != nil {
return x.IdPackage
return x.Id
}
return nil
}
func (x *AddCommentRsp) GetText() string {
if x != nil {
return x.Text
}
return ""
return 0
}
type AddCommentReq struct {
@ -727,13 +672,14 @@ type AddCommentReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,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 *AddCommentReq) Reset() {
*x = AddCommentReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[11]
mi := &file_dashboard_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -746,7 +692,7 @@ func (x *AddCommentReq) String() string {
func (*AddCommentReq) ProtoMessage() {}
func (x *AddCommentReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[11]
mi := &file_dashboard_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -759,43 +705,48 @@ func (x *AddCommentReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddCommentReq.ProtoReflect.Descriptor instead.
func (*AddCommentReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{11}
return file_dashboard_proto_rawDescGZIP(), []int{10}
}
func (x *AddCommentReq) GetId() uint64 {
func (x *AddCommentReq) GetIdPackage() *wrapperspb.UInt64Value {
if x != nil {
return x.Id
return x.IdPackage
}
return 0
return nil
}
type AddPackageRsp struct {
func (x *AddCommentReq) GetText() string {
if x != nil {
return x.Text
}
return ""
}
type AddCommentRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"`
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *AddPackageRsp) Reset() {
*x = AddPackageRsp{}
func (x *AddCommentRsp) Reset() {
*x = AddCommentRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[12]
mi := &file_dashboard_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddPackageRsp) String() string {
func (x *AddCommentRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddPackageRsp) ProtoMessage() {}
func (*AddCommentRsp) ProtoMessage() {}
func (x *AddPackageRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[12]
func (x *AddCommentRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -806,42 +757,32 @@ func (x *AddPackageRsp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use AddPackageRsp.ProtoReflect.Descriptor instead.
func (*AddPackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{12}
// Deprecated: Use AddCommentRsp.ProtoReflect.Descriptor instead.
func (*AddCommentRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{11}
}
func (x *AddPackageRsp) GetName() *wrapperspb.StringValue {
func (x *AddCommentRsp) GetId() uint64 {
if x != nil {
return x.Name
return x.Id
}
return nil
}
func (x *AddPackageRsp) GetUrl() *wrapperspb.StringValue {
if x != nil {
return x.Url
}
return nil
}
func (x *AddPackageRsp) GetModules() []uint64 {
if x != nil {
return x.Modules
}
return nil
return 0
}
type AddPackageReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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 *AddPackageReq) Reset() {
*x = AddPackageReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[13]
mi := &file_dashboard_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -854,7 +795,7 @@ func (x *AddPackageReq) String() string {
func (*AddPackageReq) ProtoMessage() {}
func (x *AddPackageReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[13]
mi := &file_dashboard_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -867,9 +808,162 @@ func (x *AddPackageReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddPackageReq.ProtoReflect.Descriptor instead.
func (*AddPackageReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{12}
}
func (x *AddPackageReq) GetName() *wrapperspb.StringValue {
if x != nil {
return x.Name
}
return nil
}
func (x *AddPackageReq) GetUrl() *wrapperspb.StringValue {
if x != nil {
return x.Url
}
return nil
}
func (x *AddPackageReq) GetModules() []uint64 {
if x != nil {
return x.Modules
}
return nil
}
type AddPackageRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *AddPackageRsp) Reset() {
*x = AddPackageRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddPackageRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddPackageRsp) ProtoMessage() {}
func (x *AddPackageRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AddPackageRsp.ProtoReflect.Descriptor instead.
func (*AddPackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{13}
}
type GetModuleReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ModulesId []uint64 `protobuf:"varint,1,rep,packed,name=modules_id,json=modulesId,proto3" json:"modules_id,omitempty"`
}
func (x *GetModuleReq) Reset() {
*x = GetModuleReq{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetModuleReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetModuleReq) ProtoMessage() {}
func (x *GetModuleReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetModuleReq.ProtoReflect.Descriptor instead.
func (*GetModuleReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{14}
}
func (x *GetModuleReq) GetModulesId() []uint64 {
if x != nil {
return x.ModulesId
}
return nil
}
type GetModuleRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Modules []*Module `protobuf:"bytes,1,rep,name=modules,proto3" json:"modules,omitempty"`
}
func (x *GetModuleRsp) Reset() {
*x = GetModuleRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetModuleRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetModuleRsp) ProtoMessage() {}
func (x *GetModuleRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetModuleRsp.ProtoReflect.Descriptor instead.
func (*GetModuleRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{15}
}
func (x *GetModuleRsp) GetModules() []*Module {
if x != nil {
return x.Modules
}
return nil
}
var File_dashboard_proto protoreflect.FileDescriptor
var file_dashboard_proto_rawDesc = []byte{
@ -932,7 +1026,7 @@ var file_dashboard_proto_rawDesc = []byte{
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, 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,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 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,
@ -947,19 +1041,19 @@ var file_dashboard_proto_rawDesc = []byte{
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,
0x61, 0x74, 0x65, 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, 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,
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 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,
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, 0x9f, 0x01, 0x0a, 0x0d,
0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x3a, 0x0a,
0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 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,
@ -969,29 +1063,39 @@ var file_dashboard_proto_rawDesc = []byte{
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,
0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x2d,
0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1d,
0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03,
0x28, 0x04, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x49, 0x64, 0x22, 0x37, 0x0a,
0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x12, 0x27, 0x0a,
0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x07, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x32, 0xc7, 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, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 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, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43,
0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 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, 0x65, 0x71, 0x1a,
0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61,
0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 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 (
@ -1006,7 +1110,7 @@ func file_dashboard_proto_rawDescGZIP() []byte {
return file_dashboard_proto_rawDescData
}
var file_dashboard_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_dashboard_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_dashboard_proto_goTypes = []interface{}{
(*ErrorRsp)(nil), // 0: proto.ErrorRsp
(*Error)(nil), // 1: proto.Error
@ -1016,37 +1120,42 @@ var file_dashboard_proto_goTypes = []interface{}{
(*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
(*UpdatePackageReq)(nil), // 8: proto.UpdatePackageReq
(*UpdatePackageRsp)(nil), // 9: proto.UpdatePackageRsp
(*AddCommentReq)(nil), // 10: proto.AddCommentReq
(*AddCommentRsp)(nil), // 11: proto.AddCommentRsp
(*AddPackageReq)(nil), // 12: proto.AddPackageReq
(*AddPackageRsp)(nil), // 13: proto.AddPackageRsp
(*GetModuleReq)(nil), // 14: proto.GetModuleReq
(*GetModuleRsp)(nil), // 15: proto.GetModuleRsp
(*wrapperspb.UInt64Value)(nil), // 16: google.protobuf.UInt64Value
(*wrapperspb.StringValue)(nil), // 17: google.protobuf.StringValue
}
var file_dashboard_proto_depIdxs = []int32{
1, // 0: proto.ErrorRsp.error:type_name -> proto.Error
2, // 1: proto.ListPackageRsp.packages:type_name -> proto.Package
14, // 2: proto.UpdatePackageRsp.id:type_name -> google.protobuf.UInt64Value
15, // 3: proto.UpdatePackageRsp.name:type_name -> google.protobuf.StringValue
15, // 4: proto.UpdatePackageRsp.url:type_name -> google.protobuf.StringValue
14, // 5: proto.AddCommentRsp.idPackage:type_name -> google.protobuf.UInt64Value
15, // 6: proto.AddPackageRsp.name:type_name -> google.protobuf.StringValue
15, // 7: proto.AddPackageRsp.url:type_name -> google.protobuf.StringValue
6, // 8: proto.DashboardService.ListPackage:input_type -> proto.ListPackageReq
8, // 9: proto.DashboardService.UpdatePackage:input_type -> proto.UpdatePackageRsp
10, // 10: proto.DashboardService.AddComment:input_type -> proto.AddCommentRsp
12, // 11: proto.DashboardService.AddPackage:input_type -> proto.AddPackageRsp
7, // 12: proto.DashboardService.ListPackage:output_type -> proto.ListPackageRsp
9, // 13: proto.DashboardService.UpdatePackage:output_type -> proto.UpdatePackageReq
11, // 14: proto.DashboardService.AddComment:output_type -> proto.AddCommentReq
13, // 15: proto.DashboardService.AddPackage:output_type -> proto.AddPackageReq
12, // [12:16] is the sub-list for method output_type
8, // [8:12] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
16, // 2: proto.UpdatePackageReq.id:type_name -> google.protobuf.UInt64Value
17, // 3: proto.UpdatePackageReq.name:type_name -> google.protobuf.StringValue
17, // 4: proto.UpdatePackageReq.url:type_name -> google.protobuf.StringValue
16, // 5: proto.AddCommentReq.idPackage:type_name -> google.protobuf.UInt64Value
17, // 6: proto.AddPackageReq.name:type_name -> google.protobuf.StringValue
17, // 7: proto.AddPackageReq.url:type_name -> google.protobuf.StringValue
3, // 8: proto.GetModuleRsp.modules:type_name -> proto.Module
6, // 9: proto.DashboardService.ListPackage:input_type -> proto.ListPackageReq
8, // 10: proto.DashboardService.UpdatePackage:input_type -> proto.UpdatePackageReq
10, // 11: proto.DashboardService.AddComment:input_type -> proto.AddCommentReq
12, // 12: proto.DashboardService.AddPackage:input_type -> proto.AddPackageReq
14, // 13: proto.DashboardService.GetModule:input_type -> proto.GetModuleReq
7, // 14: proto.DashboardService.ListPackage:output_type -> proto.ListPackageRsp
9, // 15: proto.DashboardService.UpdatePackage:output_type -> proto.UpdatePackageRsp
11, // 16: proto.DashboardService.AddComment:output_type -> proto.AddCommentRsp
13, // 17: proto.DashboardService.AddPackage:output_type -> proto.AddPackageRsp
15, // 18: proto.DashboardService.GetModule:output_type -> proto.GetModuleRsp
14, // [14:19] is the sub-list for method output_type
9, // [9:14] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
}
func init() { file_dashboard_proto_init() }
@ -1152,18 +1261,6 @@ func file_dashboard_proto_init() {
}
}
file_dashboard_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdatePackageRsp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dashboard_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdatePackageReq); i {
case 0:
return &v.state
@ -1175,8 +1272,8 @@ func file_dashboard_proto_init() {
return nil
}
}
file_dashboard_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddCommentRsp); i {
file_dashboard_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdatePackageRsp); i {
case 0:
return &v.state
case 1:
@ -1187,7 +1284,7 @@ func file_dashboard_proto_init() {
return nil
}
}
file_dashboard_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
file_dashboard_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddCommentReq); i {
case 0:
return &v.state
@ -1199,8 +1296,20 @@ func file_dashboard_proto_init() {
return nil
}
}
file_dashboard_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddCommentRsp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dashboard_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddPackageRsp); i {
switch v := v.(*AddPackageReq); i {
case 0:
return &v.state
case 1:
@ -1212,7 +1321,31 @@ func file_dashboard_proto_init() {
}
}
file_dashboard_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddPackageReq); i {
switch v := v.(*AddPackageRsp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dashboard_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetModuleReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dashboard_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetModuleRsp); i {
case 0:
return &v.state
case 1:
@ -1230,7 +1363,7 @@ func file_dashboard_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_dashboard_proto_rawDesc,
NumEnums: 0,
NumMessages: 14,
NumMessages: 16,
NumExtensions: 0,
NumServices: 1,
},

File diff suppressed because it is too large Load Diff

View File

@ -22,14 +22,16 @@ var (
type DashboardServiceClient interface {
ListPackage(ctx context.Context, req *go_generate.ListPackageReq, opts ...client.CallOption) (*go_generate.ListPackageRsp, 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)
UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, opts ...client.CallOption) (*go_generate.UpdatePackageRsp, error)
AddComment(ctx context.Context, req *go_generate.AddCommentReq, opts ...client.CallOption) (*go_generate.AddCommentRsp, error)
AddPackage(ctx context.Context, req *go_generate.AddPackageReq, opts ...client.CallOption) (*go_generate.AddPackageRsp, error)
GetModule(ctx context.Context, req *go_generate.GetModuleReq, opts ...client.CallOption) (*go_generate.GetModuleRsp, error)
}
type DashboardServiceServer interface {
ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) 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
UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, rsp *go_generate.UpdatePackageRsp) error
AddComment(ctx context.Context, req *go_generate.AddCommentReq, rsp *go_generate.AddCommentRsp) error
AddPackage(ctx context.Context, req *go_generate.AddPackageReq, rsp *go_generate.AddPackageRsp) error
GetModule(ctx context.Context, req *go_generate.GetModuleReq, rsp *go_generate.GetModuleRsp) error
}

View File

@ -31,8 +31,8 @@ func (c *dashboardServiceClient) ListPackage(ctx context.Context, req *go_genera
return rsp, nil
}
func (c *dashboardServiceClient) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, opts ...client.CallOption) (*go_generate.UpdatePackageReq, error) {
rsp := &go_generate.UpdatePackageReq{}
func (c *dashboardServiceClient) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, opts ...client.CallOption) (*go_generate.UpdatePackageRsp, error) {
rsp := &go_generate.UpdatePackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.UpdatePackage", req), rsp, opts...)
if err != nil {
return nil, err
@ -40,8 +40,8 @@ func (c *dashboardServiceClient) UpdatePackage(ctx context.Context, req *go_gene
return rsp, nil
}
func (c *dashboardServiceClient) AddComment(ctx context.Context, req *go_generate.AddCommentRsp, opts ...client.CallOption) (*go_generate.AddCommentReq, error) {
rsp := &go_generate.AddCommentReq{}
func (c *dashboardServiceClient) AddComment(ctx context.Context, req *go_generate.AddCommentReq, opts ...client.CallOption) (*go_generate.AddCommentRsp, error) {
rsp := &go_generate.AddCommentRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.AddComment", req), rsp, opts...)
if err != nil {
return nil, err
@ -49,8 +49,8 @@ func (c *dashboardServiceClient) AddComment(ctx context.Context, req *go_generat
return rsp, nil
}
func (c *dashboardServiceClient) AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, opts ...client.CallOption) (*go_generate.AddPackageReq, error) {
rsp := &go_generate.AddPackageReq{}
func (c *dashboardServiceClient) AddPackage(ctx context.Context, req *go_generate.AddPackageReq, opts ...client.CallOption) (*go_generate.AddPackageRsp, error) {
rsp := &go_generate.AddPackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.AddPackage", req), rsp, opts...)
if err != nil {
return nil, err
@ -58,6 +58,15 @@ func (c *dashboardServiceClient) AddPackage(ctx context.Context, req *go_generat
return rsp, nil
}
func (c *dashboardServiceClient) GetModule(ctx context.Context, req *go_generate.GetModuleReq, opts ...client.CallOption) (*go_generate.GetModuleRsp, error) {
rsp := &go_generate.GetModuleRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.GetModule", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
type dashboardServiceServer struct {
DashboardServiceServer
}
@ -66,24 +75,29 @@ func (h *dashboardServiceServer) ListPackage(ctx context.Context, req *go_genera
return h.DashboardServiceServer.ListPackage(ctx, req, rsp)
}
func (h *dashboardServiceServer) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageRsp, rsp *go_generate.UpdatePackageReq) error {
func (h *dashboardServiceServer) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, rsp *go_generate.UpdatePackageRsp) error {
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.AddCommentReq, rsp *go_generate.AddCommentRsp) error {
return h.DashboardServiceServer.AddComment(ctx, req, rsp)
}
func (h *dashboardServiceServer) AddPackage(ctx context.Context, req *go_generate.AddPackageRsp, rsp *go_generate.AddPackageReq) error {
func (h *dashboardServiceServer) AddPackage(ctx context.Context, req *go_generate.AddPackageReq, rsp *go_generate.AddPackageRsp) error {
return h.DashboardServiceServer.AddPackage(ctx, req, rsp)
}
func (h *dashboardServiceServer) GetModule(ctx context.Context, req *go_generate.GetModuleReq, rsp *go_generate.GetModuleRsp) error {
return h.DashboardServiceServer.GetModule(ctx, req, rsp)
}
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
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
UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, rsp *go_generate.UpdatePackageRsp) error
AddComment(ctx context.Context, req *go_generate.AddCommentReq, rsp *go_generate.AddCommentRsp) error
AddPackage(ctx context.Context, req *go_generate.AddPackageReq, rsp *go_generate.AddPackageRsp) error
GetModule(ctx context.Context, req *go_generate.GetModuleReq, rsp *go_generate.GetModuleRsp) error
}
type DashboardService struct {
dashboardService

View File

@ -24,26 +24,26 @@ import (
)
type Client interface {
Run(ctx context.Context, st storage.Storage) chan *pb.AddPackageRsp
Run(ctx context.Context, st storage.Storage) chan *pb.AddPackageReq
IsClose() bool
Done() <-chan struct{}
}
type client struct {
worker chan *pb.AddPackageRsp
worker chan *pb.AddPackageReq
closed bool
lock chan struct{}
}
func NewClient(cap uint) Client {
return &client{
make(chan *pb.AddPackageRsp, cap),
make(chan *pb.AddPackageReq, cap),
false,
make(chan struct{}),
}
}
func (c *client) Run(ctx context.Context, st storage.Storage) chan *pb.AddPackageRsp {
func (c *client) Run(ctx context.Context, st storage.Storage) chan *pb.AddPackageReq {
go func() {
defer close(c.worker)
for {
@ -71,8 +71,8 @@ func (c *client) Done() <-chan struct{} {
return c.lock
}
func runner(ctx context.Context, st storage.Storage, rsp *pb.AddPackageRsp) {
modules, err := getGoModule(ctx, rsp.Url.Value)
func runner(ctx context.Context, st storage.Storage, req *pb.AddPackageReq) {
modules, err := getGoModule(ctx, req.Url.Value)
if err != nil {
logger.Error(ctx, err)
return
@ -80,12 +80,12 @@ func runner(ctx context.Context, st storage.Storage, rsp *pb.AddPackageRsp) {
logger.Infof(ctx, "success get list mod", modules)
if rsp.Modules, err = st.InsertButchModules(ctx, modules); err != nil {
if req.Modules, err = st.InsertButchModules(ctx, modules); err != nil {
logger.Error(ctx, err)
return
}
if err = st.AddPackage(ctx, rsp); err != nil {
if err = st.AddPackage(ctx, req); err != nil {
logger.Error(ctx, err)
}
}

View File

@ -39,7 +39,7 @@ func TestClientPG(t *testing.T) {
ch := cli.Run(ctx, s)
data := &pb.AddPackageRsp{
data := &pb.AddPackageReq{
Name: wrapperspb.String("test"),
Url: wrapperspb.String("https://github.com/dantedenis/service_history.git"),
}
@ -75,7 +75,7 @@ func TestClientLite(t *testing.T) {
ch := cli.Run(ctx, s)
data := &pb.AddPackageRsp{
data := &pb.AddPackageReq{
Name: wrapperspb.String("test"),
Url: wrapperspb.String("https://github.com/dantedenis/service_history.git"),
}

View File

@ -132,6 +132,7 @@ func NewService(ctx context.Context) (micro.Service, error) {
mux.HandleFunc("/updatePackage", handler.Methods(http.MethodPost, h.UpdatePackage))
mux.HandleFunc("/addComment", handler.Methods(http.MethodPut, h.AddComment))
mux.HandleFunc("/addPackage", handler.Methods(http.MethodPost, h.AddPackage))
mux.HandleFunc("/getModule", handler.Methods(http.MethodGet, h.GetModule))
if err = svc.Server().Handle(svc.Server().NewHandler(mux)); err != nil {
logger.Fatalf(ctx, "failed to register handler: %v", err)

View File

@ -89,7 +89,7 @@ func (s *Postgres) MigrateDown() error {
return nil
}
func (s *Postgres) UpdatePackage(ctx context.Context, rsp *pb.UpdatePackageRsp) error {
func (s *Postgres) UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error {
panic("need implement")
}
@ -122,7 +122,7 @@ func (s *Postgres) ListPackage(ctx context.Context) (models.ListPackage, error)
return result, err
}
func (s *Postgres) AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error {
func (s *Postgres) AddComment(ctx context.Context, req *pb.AddCommentReq) error {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return err
@ -138,7 +138,7 @@ func (s *Postgres) AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error
}
}()
res, err := tx.ExecContext(ctx, queryAddComment, rsp.Text, rsp.IdPackage.Value)
res, err := tx.ExecContext(ctx, queryAddComment, req.Text, req.IdPackage.Value)
if err != nil {
return err
}
@ -152,7 +152,7 @@ func (s *Postgres) AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error
return err
}
func (s *Postgres) AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error {
func (s *Postgres) AddPackage(ctx context.Context, req *pb.AddPackageReq) error {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return err
@ -168,7 +168,7 @@ func (s *Postgres) AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error
}
}()
res, err := tx.ExecContext(ctx, queryAddPackage, rsp.Name.Value, rsp.Url.Value, pq.Array(rsp.Modules))
res, err := tx.ExecContext(ctx, queryAddPackage, req.Name.Value, req.Url.Value, pq.Array(req.Modules))
if err != nil {
return err
}
@ -182,7 +182,7 @@ func (s *Postgres) AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error
return err
}
func (s *Postgres) InsertButchModules(ctx context.Context, rsp []models.Module) ([]uint64, error) {
func (s *Postgres) InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error) {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return nil, err
@ -197,7 +197,7 @@ func (s *Postgres) InsertButchModules(ctx context.Context, rsp []models.Module)
}
}()
query := generateQuery(rsp)
query := generateQuery(req)
rows, err := tx.QueryContext(ctx, query)
if err != nil {

View File

@ -9,16 +9,28 @@ import (
func TestGenerate(t *testing.T) {
m := []models.Module{
{
1, "test", "1.2.3", 2, "23.31",
ID: 1,
Name: "test",
Version: "1.2.3",
Package: 2,
LastVersion: "23.31",
},
{
1, "321test", "1.3", 4, "2111.31",
ID: 1,
Name: "321test",
Version: "1.3",
Package: 4,
LastVersion: "2111.31",
},
{
1, "testabcd", "1.2.3", 2, "153453.31",
ID: 1,
Name: "testabcd",
Version: "1.2.3",
Package: 2,
LastVersion: "153453.31",
},
}
str := generateQuery(m)
fmt.Println(str)

View File

@ -91,7 +91,7 @@ func (s *Sqlite) MigrateDown() error {
return nil
}
func (s *Sqlite) UpdatePackage(ctx context.Context, rsp *pb.UpdatePackageRsp) error {
func (s *Sqlite) UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error {
panic("need implement")
}
@ -124,7 +124,7 @@ func (s *Sqlite) ListPackage(ctx context.Context) (models.ListPackage, error) {
return result, err
}
func (s *Sqlite) AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error {
func (s *Sqlite) AddComment(ctx context.Context, req *pb.AddCommentReq) error {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return err
@ -140,7 +140,7 @@ func (s *Sqlite) AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error {
}
}()
res, err := tx.ExecContext(ctx, queryAddComment, rsp.Text, rsp.IdPackage.Value)
res, err := tx.ExecContext(ctx, queryAddComment, req.Text, req.IdPackage.Value)
if err != nil {
return err
}
@ -154,7 +154,7 @@ func (s *Sqlite) AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error {
return err
}
func (s *Sqlite) AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error {
func (s *Sqlite) AddPackage(ctx context.Context, req *pb.AddPackageReq) error {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return err
@ -170,7 +170,7 @@ func (s *Sqlite) AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error {
}
}()
res, err := tx.ExecContext(ctx, queryAddPackage, rsp.Name.Value, rsp.Url.Value, pq.Array(rsp.Modules))
res, err := tx.ExecContext(ctx, queryAddPackage, req.Name.Value, req.Url.Value, pq.Array(req.Modules))
if err != nil {
return err
}
@ -184,7 +184,7 @@ func (s *Sqlite) AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error {
return err
}
func (s *Sqlite) InsertButchModules(ctx context.Context, rsp []models.Module) ([]uint64, error) {
func (s *Sqlite) InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error) {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return nil, err
@ -199,7 +199,7 @@ func (s *Sqlite) InsertButchModules(ctx context.Context, rsp []models.Module) ([
}
}()
query := generateQuery(rsp)
query := generateQuery(req)
rows, err := tx.QueryContext(ctx, query)
if err != nil {

View File

@ -28,10 +28,10 @@ type Storage interface {
cmsstorage.Migrator
ListPackage(ctx context.Context) (models.ListPackage, error)
UpdatePackage(ctx context.Context, rsp *pb.UpdatePackageRsp) error
AddComment(ctx context.Context, rsp *pb.AddCommentRsp) error
AddPackage(ctx context.Context, rsp *pb.AddPackageRsp) error
InsertButchModules(ctx context.Context, rsp []models.Module) ([]uint64, error)
UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error
AddComment(ctx context.Context, req *pb.AddCommentReq) error
AddPackage(ctx context.Context, req *pb.AddPackageReq) error
InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error)
}
func NewStorage(name string, db *sql.DB) (interface{}, error) {