[In Progress] init layout #2

Merged
vtolstov merged 2 commits from devstigneev/pkgdash:master into master 2023-08-09 15:42:15 +03:00
22 changed files with 1996 additions and 194 deletions
Showing only changes of commit bbb9174d8a - Show all commits

25
go.mod
View File

@ -5,14 +5,20 @@ go 1.20
require ( require (
github.com/envoyproxy/protoc-gen-validate v1.0.2 github.com/envoyproxy/protoc-gen-validate v1.0.2
github.com/go-git/go-git/v5 v5.8.1 github.com/go-git/go-git/v5 v5.8.1
github.com/golang-migrate/migrate/v4 v4.15.1
github.com/google/uuid v1.3.0
github.com/jackc/pgtype v1.14.0 github.com/jackc/pgtype v1.14.0
github.com/pkg/errors v0.9.1
go.unistack.org/cms-service v0.0.1 go.unistack.org/cms-service v0.0.1
go.unistack.org/micro-client-http/v3 v3.9.3
go.unistack.org/micro-config-flag/v4 v4.0.1 go.unistack.org/micro-config-flag/v4 v4.0.1
go.unistack.org/micro-proto/v3 v3.3.1
go.unistack.org/micro-server-grpc/v3 v3.10.6 go.unistack.org/micro-server-grpc/v3 v3.10.6
go.unistack.org/micro-server-http/v3 v3.11.6 go.unistack.org/micro-server-http/v3 v3.11.6
go.unistack.org/micro/v3 v3.10.25 go.unistack.org/micro/v3 v3.10.24
go.unistack.org/micro/v4 v4.0.5 go.unistack.org/micro/v4 v4.0.1
golang.org/x/mod v0.12.0 golang.org/x/mod v0.12.0
golang.org/x/net v0.12.0
golang.org/x/sync v0.3.0 golang.org/x/sync v0.3.0
google.golang.org/protobuf v1.31.0 google.golang.org/protobuf v1.31.0
) )
@ -29,15 +35,23 @@ require (
github.com/go-git/go-billy/v5 v5.4.1 // indirect github.com/go-git/go-billy/v5 v5.4.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect github.com/imdario/mergo v0.3.16 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.0 // indirect
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect
github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v4 v4.18.1 // indirect
github.com/jackc/pgx/v5 v5.3.1 // indirect github.com/jackc/pgx/v5 v5.3.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lyft/protoc-gen-star/v2 v2.0.3 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect github.com/mattn/go-isatty v0.0.18 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect
@ -45,7 +59,9 @@ require (
github.com/sergi/go-diff v1.3.1 // indirect github.com/sergi/go-diff v1.3.1 // indirect
github.com/sijms/go-ora/v2 v2.6.7 // indirect github.com/sijms/go-ora/v2 v2.6.7 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect github.com/skeema/knownhosts v1.2.0 // indirect
github.com/spf13/afero v1.3.3 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.unistack.org/cms-api-proto v0.0.5 // indirect go.unistack.org/cms-api-proto v0.0.5 // indirect
go.unistack.org/micro-broker-service/v3 v3.8.2 // indirect go.unistack.org/micro-broker-service/v3 v3.8.2 // indirect
go.unistack.org/micro-codec-yaml/v3 v3.10.0 // indirect go.unistack.org/micro-codec-yaml/v3 v3.10.0 // indirect
@ -53,9 +69,8 @@ require (
go.unistack.org/micro-config-file/v3 v3.8.3 // indirect go.unistack.org/micro-config-file/v3 v3.8.3 // indirect
go.unistack.org/micro-config-flag/v3 v3.8.9 // indirect go.unistack.org/micro-config-flag/v3 v3.8.9 // indirect
go.unistack.org/micro-config-service/v3 v3.8.1 // indirect go.unistack.org/micro-config-service/v3 v3.8.1 // indirect
go.unistack.org/micro-proto/v3 v3.3.1 // indirect
golang.org/x/crypto v0.11.0 // indirect golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/sys v0.10.0 // indirect golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect golang.org/x/text v0.11.0 // indirect
golang.org/x/tools v0.11.0 // indirect golang.org/x/tools v0.11.0 // indirect

906
go.sum

File diff suppressed because it is too large Load Diff

25
handler/encoders/json.go Normal file
View File

@ -0,0 +1,25 @@
package encoders
import (
"encoding/json"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
"net/http"
"github.com/pkg/errors"
)
type JSON struct{}
func (*JSON) Success(rw http.ResponseWriter, response interface{}) error {
rw.Header().Set("Content-Type", "application/json; charset=utf-8")
rw.WriteHeader(http.StatusOK)
return errors.WithStack(json.NewEncoder(rw).Encode(response))
}
func (*JSON) Error(rw http.ResponseWriter, err *pb.Error, status int) error {
rw.Header().Set("Content-Type", "application/problem+json; charset=utf-8")
rw.WriteHeader(status)
return errors.WithStack(json.NewEncoder(rw).Encode(&pb.ErrorRsp{Error: err}))
}

View File

@ -0,0 +1,51 @@
package encoders
import (
"github.com/pkg/errors"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"io"
"net/http"
)
var ErrWrongResponseType = errors.New("JSONProto: wrong response message type")
type JSONProto struct {
m protojson.MarshalOptions
}
func NewJSONProto() *JSONProto {
return &JSONProto{m: protojson.MarshalOptions{
EmitUnpopulated: true,
UseProtoNames: false,
}}
}
func (e *JSONProto) Success(rw http.ResponseWriter, response interface{}) error {
rw.Header().Set("Content-Type", "application/json; charset=utf-8")
rw.WriteHeader(http.StatusOK)
if v, ok := response.(proto.Message); ok {
return errors.WithStack(e.Fmarshal(rw, v))
}
return ErrWrongResponseType
}
func (e *JSONProto) Error(rw http.ResponseWriter, err *pb.Error, status int) error {
rw.Header().Set("Content-Type", "application/problem+json; charset=utf-8")
rw.WriteHeader(status)
return errors.WithStack(e.Fmarshal(rw, &pb.ErrorRsp{Error: err}))
}
func (e *JSONProto) Fmarshal(w io.Writer, m proto.Message) error {
b, err := e.m.Marshal(m)
if len(b) > 0 {
if _, err = w.Write(b); err != nil {
return err
}
}
return err
}

67
handler/errors.go Normal file
View File

@ -0,0 +1,67 @@
package handler
import "github.com/pkg/errors"
type UnmarshalError struct {
err error
}
func (e *UnmarshalError) Error() string {
return e.err.Error()
}
func (e *UnmarshalError) Unwrap() error {
return e.err
}
func NewUnmarshalError(err error) error {
return errors.WithStack(&UnmarshalError{err: err})
}
type InternalError struct {
Err error
}
func (e *InternalError) Error() string {
return e.Err.Error()
}
func NewInternalError(err error) error {
return errors.WithStack(&InternalError{Err: err})
}
type ParametersMissingError struct {
Err error
}
func (e *ParametersMissingError) Error() string {
return e.Err.Error()
}
func NewParametersMissingError(err error) error {
return errors.WithStack(&ParametersMissingError{Err: err})
}
type NotFoundError struct {
Err error
}
func (e *NotFoundError) Error() string {
return e.Err.Error()
}
func NewNotFoundError(err error) error {
return errors.WithStack(&NotFoundError{Err: err})
}
type ValidationError struct {
Err error
}
func (e *ValidationError) Error() string {
return e.Err.Error()
}
func NewValidationError(err error) error {
return errors.WithStack(&ValidationError{Err: err})
}

View File

@ -2,39 +2,60 @@ package handler
import ( import (
"context" "context"
"go.unistack.org/unistack-org/pkgdash/proto/go_generate"
cmsstorage "go.unistack.org/cms-service/storage" cmsstorage "go.unistack.org/cms-service/storage"
"go.unistack.org/micro/v3" "go.unistack.org/micro/v3"
"go.unistack.org/micro/v3/errors" "go.unistack.org/micro/v3/errors"
"go.unistack.org/unistack-org/pkgdash/config" "go.unistack.org/unistack-org/pkgdash/config"
"golang.org/x/mod/sumdb/storage" "go.unistack.org/unistack-org/pkgdash/models"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
"go.unistack.org/unistack-org/pkgdash/storage"
"net/http"
) )
type Handler struct { type Handler struct {
//db *xorm.Engine
svc micro.Service svc micro.Service
store storage.Storage store storage.Storage
writer writer
} }
func (h *Handler) ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error { func (h *Handler) ListPackage(w http.ResponseWriter, r *http.Request) {
//TODO implement me ctx := r.Context()
panic("implement me") logger := h.svc.Logger()
logger.Debug(ctx, "Start getListPackage")
dbRsp, err := h.store.List(ctx)
if err != nil {
logger.Errorf(ctx, "error db response: %v", err)
h.writer.Response(ctx, w, err)
return
}
rsp := new(pb.ListPackageRsp)
rsp.Packages = models.ListPackage(dbRsp).Mapping()
logger.Debug(ctx, "Success finish getListPackage")
h.writer.Response(ctx, w, rsp)
} }
func (h *Handler) UpdateInfo(ctx context.Context, req *go_generate.UpdateInfoPackageRsp, rsp *go_generate.UpdateInfoPackageReq) error { func (h *Handler) UpdateInfo(w http.ResponseWriter, r *http.Request) {
//TODO implement me ctx := r.Context()
panic("implement me") logger := h.svc.Logger()
logger.Debug(ctx, "Start UpdateInfo")
// TODO
} }
func (h *Handler) AddComment(ctx context.Context, req *go_generate.CommentRsp, rsp *go_generate.CommentReq) error { func (h *Handler) AddComment(w http.ResponseWriter, r *http.Request) {
//TODO implement me ctx := r.Context()
panic("implement me") logger := h.svc.Logger()
logger.Debug(ctx, "Start AddComment")
// TODO
} }
func NewHandler(svc micro.Service) *Handler { func NewHandler(svc micro.Service, w writer) *Handler {
return &Handler{svc: svc} return &Handler{svc: svc, writer: w}
} }
func (h *Handler) Init(ctx context.Context) error { func (h *Handler) Init(ctx context.Context) error {

34
handler/mapping.go Normal file
View File

@ -0,0 +1,34 @@
package handler
import (
"errors"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
"net/http"
"golang.org/x/net/context"
)
const (
internalErrorCode = "1"
badRequestCode = "2"
notFoundErrorCode = "3"
)
func mapError(ctx context.Context, err error) (result *pb.Error, status int) {
status = http.StatusBadRequest
switch errors.Unwrap(err).(type) {
case *UnmarshalError:
result = &pb.Error{Code: badRequestCode, Title: "Bad request"}
case *ParametersMissingError:
result = &pb.Error{Code: badRequestCode, Title: "Required parameters are missing"}
case *NotFoundError:
result = &pb.Error{Code: notFoundErrorCode, Title: "Not found"}
status = http.StatusNotFound
default:
status = http.StatusInternalServerError
result = &pb.Error{Code: internalErrorCode, Title: "Internal error", Details: err.Error()}
}
return
}

76
handler/writer.go Normal file
View File

@ -0,0 +1,76 @@
package handler
import (
"context"
"go.unistack.org/micro/v4/logger"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
"net/http"
"github.com/pkg/errors"
)
type encoder interface {
Success(rw http.ResponseWriter, response interface{}) error
Error(rw http.ResponseWriter, err *pb.Error, status int) error
}
type writer interface {
Response(ctx context.Context, rw http.ResponseWriter, value interface{})
}
type stackTracer interface {
StackTrace() errors.StackTrace
}
type Writer struct {
encoder encoder
}
func NewWriter(encoder encoder) (*Writer, error) {
if encoder == nil {
return nil, errors.New("empty encoder")
}
return &Writer{encoder: encoder}, nil
}
func (w *Writer) Response(ctx context.Context, rw http.ResponseWriter, value interface{}) {
var err error
if v, ok := value.(error); ok {
err = w.error(ctx, rw, v)
} else {
err = w.success(rw, value)
}
if err != nil {
logger.Error(ctx, "Response writing error: ", err)
}
}
func (w *Writer) error(ctx context.Context, rw http.ResponseWriter, err error) error {
e, status := mapError(ctx, err)
/*
switch {
case status >= http.StatusInternalServerError:
logger.Errorf(ctx, "error: %s, code: %s, http status: %d, uuid: %s", err, e.Code, status, e.Uuid)
if err, ok := err.(stackTracer); ok {
logger.Errorf(ctx, "error stacktrace: %+v, uuid: %s", err.StackTrace(), e.Uuid)
}
default:
logger.Infof(ctx, "error: %s, code: %s, http status: %d, uuid: %s", err, e.Code, status, e.Uuid)
if err, ok := err.(stackTracer); ok {
logger.Infof(ctx, "error stacktrace: %+v, uuid: %s", err.StackTrace(), e.Uuid)
}
}
*/
return w.encoder.Error(rw, e, status)
}
func (w *Writer) success(rw http.ResponseWriter, value interface{}) error {
return w.encoder.Success(rw, value)
}

View File

@ -2,36 +2,43 @@ package models
import ( import (
_ "database/sql" _ "database/sql"
"github.com/google/uuid"
"github.com/jackc/pgtype" "github.com/jackc/pgtype"
) )
type DBPackage struct { type Package struct {
Name string `db:"name"` // service name, last component path ID int64 `db:"id"` // package id
URL string `db:"url"` // scm url Name string `db:"name"` // service name, last component path
Modules []DBModule `db:"modules"` // parsed go.mod modules URL string `db:"url"` // scm url
ID int64 `db:"id"` // package id Modules []Module `db:"modules"` // parsed go.mod modules
Issues []DBIssue `db:"issues"` // issues list Issues []Issue `db:"issues"` // issues list
Comments []int64 `db:"comments"`
} }
type DBModule struct { type Module struct {
ID int64 `db:"id"`
Name string `db:"name"` // module name Name string `db:"name"` // module name
Version string `db:"version"` // module Version string `db:"version"` // module
ID int64 `db:"id"`
Package int64 `db:"package"` Package int64 `db:"package"`
} }
type DBIssue struct { type Issue struct {
ID int64 `db:"id"` ID int64 `db:"id"`
Package int64 `db:"package"`
Modules []int64 `db:"modules"`
Status int64 `db:"status"` Status int64 `db:"status"`
Desc string `db:"desc"` Desc string `db:"desc"`
Package int64 `db:"package"`
Modules []int64 `db:"modules"`
} }
type DBComment struct { type Comment struct {
ID int64 `db:"id"` ID int64 `db:"id"`
Package int64 `db:"package"`
Text string `db:"value"` Text string `db:"value"`
Created pgtype.Date `db:"created"` Created pgtype.Date `db:"created"`
Updated pgtype.Date `db:"updated"` Updated pgtype.Date `db:"updated"`
} }
type Dashboard struct {
ID int64 `db:"id"`
Uuid uuid.UUID `db:"uuid"`
Package int64 `db:"package"`
}

13
models/mapping.go Normal file
View File

@ -0,0 +1,13 @@
package models
import (
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
)
type ListPackage []*Package
func (l ListPackage) Mapping() []*pb.Package {
result := make([]*pb.Package, 0, len(l))
return result
}

View File

@ -12,6 +12,17 @@ service DashboardService {
rpc AddComment(CommentRsp) returns (CommentReq) {}; rpc AddComment(CommentRsp) returns (CommentReq) {};
}; };
message ErrorRsp {
Error error = 1 [json_name = "error"];
}
message Error {
string code = 1 [json_name = "code"];
string title = 2 [json_name = "title"];
string uuid = 3 [json_name = "uuid"];
string details = 4 [json_name = "details"];
}
message Package { message Package {
uint64 id = 1 [(validate.rules).uint64.gt = 0]; uint64 id = 1 [(validate.rules).uint64.gt = 0];
string name = 2 [(validate.rules).string.min_len = 1]; string name = 2 [(validate.rules).string.min_len = 1];

View File

@ -1,4 +1,5 @@
//go:build ignore //go:build tools
// +build tools
package proto package proto

View File

@ -1,12 +1,14 @@
#!/bin/sh -ex #!/bin/sh -ex
PROTO_ARGS=" \ PROTO_ARGS=" \
--proto_path=$(go list -f '{{ .Dir }}' -m github.com/envoyproxy/protoc-gen-validate) \ --proto_path=$(go list -f '{{ .Dir }}' -m github.com/envoyproxy/protoc-gen-validate) \
--proto_path=$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) \ --proto_path=$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) \
--go_out=paths=source_relative:go_generate \ --go_out=paths=source_relative:go_generate \
--go-micro_out=module=go.unistack.org/unistack-org/pkgdash/proto/go_generate,components=micro|grpc,standalone=true:./micro \ --go-micro_out=module=go.unistack.org/unistack-org/pkgdash/proto/go_generate,components=micro|http,standalone=true:./micro \
--validate_out=paths=source_relative,lang=go:go_generate" --validate_out=paths=source_relative,lang=go:go_generate
"
rm -rf micro go_generate find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" \) -delete
mkdir -p micro go_generate mkdir -p micro go_generate && \
protoc -I. $PROTO_ARGS ./*.proto protoc -I. $PROTO_ARGS ./*.proto || \
find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" \) -delete

View File

@ -21,6 +21,124 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type ErrorRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
}
func (x *ErrorRsp) Reset() {
*x = ErrorRsp{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ErrorRsp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ErrorRsp) ProtoMessage() {}
func (x *ErrorRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ErrorRsp.ProtoReflect.Descriptor instead.
func (*ErrorRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{0}
}
func (x *ErrorRsp) GetError() *Error {
if x != nil {
return x.Error
}
return nil
}
type Error struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"`
Details string `protobuf:"bytes,4,opt,name=details,proto3" json:"details,omitempty"`
}
func (x *Error) Reset() {
*x = Error{}
if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Error) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Error) ProtoMessage() {}
func (x *Error) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Error.ProtoReflect.Descriptor instead.
func (*Error) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{1}
}
func (x *Error) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *Error) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *Error) GetUuid() string {
if x != nil {
return x.Uuid
}
return ""
}
func (x *Error) GetDetails() string {
if x != nil {
return x.Details
}
return ""
}
type Package struct { type Package struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -36,7 +154,7 @@ type Package struct {
func (x *Package) Reset() { func (x *Package) Reset() {
*x = Package{} *x = Package{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[0] mi := &file_dashboard_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -49,7 +167,7 @@ func (x *Package) String() string {
func (*Package) ProtoMessage() {} func (*Package) ProtoMessage() {}
func (x *Package) ProtoReflect() protoreflect.Message { func (x *Package) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[0] mi := &file_dashboard_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -62,7 +180,7 @@ func (x *Package) ProtoReflect() protoreflect.Message {
// Deprecated: Use Package.ProtoReflect.Descriptor instead. // Deprecated: Use Package.ProtoReflect.Descriptor instead.
func (*Package) Descriptor() ([]byte, []int) { func (*Package) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{0} return file_dashboard_proto_rawDescGZIP(), []int{2}
} }
func (x *Package) GetId() uint64 { func (x *Package) GetId() uint64 {
@ -114,7 +232,7 @@ type Module struct {
func (x *Module) Reset() { func (x *Module) Reset() {
*x = Module{} *x = Module{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[1] mi := &file_dashboard_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -127,7 +245,7 @@ func (x *Module) String() string {
func (*Module) ProtoMessage() {} func (*Module) ProtoMessage() {}
func (x *Module) ProtoReflect() protoreflect.Message { func (x *Module) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[1] mi := &file_dashboard_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -140,7 +258,7 @@ func (x *Module) ProtoReflect() protoreflect.Message {
// Deprecated: Use Module.ProtoReflect.Descriptor instead. // Deprecated: Use Module.ProtoReflect.Descriptor instead.
func (*Module) Descriptor() ([]byte, []int) { func (*Module) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{1} return file_dashboard_proto_rawDescGZIP(), []int{3}
} }
func (x *Module) GetId() uint64 { func (x *Module) GetId() uint64 {
@ -186,7 +304,7 @@ type Issue struct {
func (x *Issue) Reset() { func (x *Issue) Reset() {
*x = Issue{} *x = Issue{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[2] mi := &file_dashboard_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -199,7 +317,7 @@ func (x *Issue) String() string {
func (*Issue) ProtoMessage() {} func (*Issue) ProtoMessage() {}
func (x *Issue) ProtoReflect() protoreflect.Message { func (x *Issue) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[2] mi := &file_dashboard_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -212,7 +330,7 @@ func (x *Issue) ProtoReflect() protoreflect.Message {
// Deprecated: Use Issue.ProtoReflect.Descriptor instead. // Deprecated: Use Issue.ProtoReflect.Descriptor instead.
func (*Issue) Descriptor() ([]byte, []int) { func (*Issue) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{2} return file_dashboard_proto_rawDescGZIP(), []int{4}
} }
func (x *Issue) GetId() uint64 { func (x *Issue) GetId() uint64 {
@ -265,7 +383,7 @@ type Comment struct {
func (x *Comment) Reset() { func (x *Comment) Reset() {
*x = Comment{} *x = Comment{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[3] mi := &file_dashboard_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -278,7 +396,7 @@ func (x *Comment) String() string {
func (*Comment) ProtoMessage() {} func (*Comment) ProtoMessage() {}
func (x *Comment) ProtoReflect() protoreflect.Message { func (x *Comment) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[3] mi := &file_dashboard_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -291,7 +409,7 @@ func (x *Comment) ProtoReflect() protoreflect.Message {
// Deprecated: Use Comment.ProtoReflect.Descriptor instead. // Deprecated: Use Comment.ProtoReflect.Descriptor instead.
func (*Comment) Descriptor() ([]byte, []int) { func (*Comment) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{3} return file_dashboard_proto_rawDescGZIP(), []int{5}
} }
func (x *Comment) GetId() uint64 { func (x *Comment) GetId() uint64 {
@ -338,7 +456,7 @@ type ListPackageReq struct {
func (x *ListPackageReq) Reset() { func (x *ListPackageReq) Reset() {
*x = ListPackageReq{} *x = ListPackageReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[4] mi := &file_dashboard_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -351,7 +469,7 @@ func (x *ListPackageReq) String() string {
func (*ListPackageReq) ProtoMessage() {} func (*ListPackageReq) ProtoMessage() {}
func (x *ListPackageReq) ProtoReflect() protoreflect.Message { func (x *ListPackageReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[4] mi := &file_dashboard_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -364,7 +482,7 @@ func (x *ListPackageReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListPackageReq.ProtoReflect.Descriptor instead. // Deprecated: Use ListPackageReq.ProtoReflect.Descriptor instead.
func (*ListPackageReq) Descriptor() ([]byte, []int) { func (*ListPackageReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{4} return file_dashboard_proto_rawDescGZIP(), []int{6}
} }
type ListPackageRsp struct { type ListPackageRsp struct {
@ -378,7 +496,7 @@ type ListPackageRsp struct {
func (x *ListPackageRsp) Reset() { func (x *ListPackageRsp) Reset() {
*x = ListPackageRsp{} *x = ListPackageRsp{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[5] mi := &file_dashboard_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -391,7 +509,7 @@ func (x *ListPackageRsp) String() string {
func (*ListPackageRsp) ProtoMessage() {} func (*ListPackageRsp) ProtoMessage() {}
func (x *ListPackageRsp) ProtoReflect() protoreflect.Message { func (x *ListPackageRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[5] mi := &file_dashboard_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -404,7 +522,7 @@ func (x *ListPackageRsp) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListPackageRsp.ProtoReflect.Descriptor instead. // Deprecated: Use ListPackageRsp.ProtoReflect.Descriptor instead.
func (*ListPackageRsp) Descriptor() ([]byte, []int) { func (*ListPackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{5} return file_dashboard_proto_rawDescGZIP(), []int{7}
} }
func (x *ListPackageRsp) GetPackages() []*Package { func (x *ListPackageRsp) GetPackages() []*Package {
@ -425,7 +543,7 @@ type UpdateInfoPackageRsp struct {
func (x *UpdateInfoPackageRsp) Reset() { func (x *UpdateInfoPackageRsp) Reset() {
*x = UpdateInfoPackageRsp{} *x = UpdateInfoPackageRsp{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[6] mi := &file_dashboard_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -438,7 +556,7 @@ func (x *UpdateInfoPackageRsp) String() string {
func (*UpdateInfoPackageRsp) ProtoMessage() {} func (*UpdateInfoPackageRsp) ProtoMessage() {}
func (x *UpdateInfoPackageRsp) ProtoReflect() protoreflect.Message { func (x *UpdateInfoPackageRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[6] mi := &file_dashboard_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -451,7 +569,7 @@ func (x *UpdateInfoPackageRsp) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateInfoPackageRsp.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateInfoPackageRsp.ProtoReflect.Descriptor instead.
func (*UpdateInfoPackageRsp) Descriptor() ([]byte, []int) { func (*UpdateInfoPackageRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{6} return file_dashboard_proto_rawDescGZIP(), []int{8}
} }
func (x *UpdateInfoPackageRsp) GetId() uint64 { func (x *UpdateInfoPackageRsp) GetId() uint64 {
@ -472,7 +590,7 @@ type UpdateInfoPackageReq struct {
func (x *UpdateInfoPackageReq) Reset() { func (x *UpdateInfoPackageReq) Reset() {
*x = UpdateInfoPackageReq{} *x = UpdateInfoPackageReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[7] mi := &file_dashboard_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -485,7 +603,7 @@ func (x *UpdateInfoPackageReq) String() string {
func (*UpdateInfoPackageReq) ProtoMessage() {} func (*UpdateInfoPackageReq) ProtoMessage() {}
func (x *UpdateInfoPackageReq) ProtoReflect() protoreflect.Message { func (x *UpdateInfoPackageReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[7] mi := &file_dashboard_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -498,7 +616,7 @@ func (x *UpdateInfoPackageReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateInfoPackageReq.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateInfoPackageReq.ProtoReflect.Descriptor instead.
func (*UpdateInfoPackageReq) Descriptor() ([]byte, []int) { func (*UpdateInfoPackageReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{7} return file_dashboard_proto_rawDescGZIP(), []int{9}
} }
func (x *UpdateInfoPackageReq) GetId() uint64 { func (x *UpdateInfoPackageReq) GetId() uint64 {
@ -520,7 +638,7 @@ type CommentRsp struct {
func (x *CommentRsp) Reset() { func (x *CommentRsp) Reset() {
*x = CommentRsp{} *x = CommentRsp{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[8] mi := &file_dashboard_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -533,7 +651,7 @@ func (x *CommentRsp) String() string {
func (*CommentRsp) ProtoMessage() {} func (*CommentRsp) ProtoMessage() {}
func (x *CommentRsp) ProtoReflect() protoreflect.Message { func (x *CommentRsp) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[8] mi := &file_dashboard_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -546,7 +664,7 @@ func (x *CommentRsp) ProtoReflect() protoreflect.Message {
// Deprecated: Use CommentRsp.ProtoReflect.Descriptor instead. // Deprecated: Use CommentRsp.ProtoReflect.Descriptor instead.
func (*CommentRsp) Descriptor() ([]byte, []int) { func (*CommentRsp) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{8} return file_dashboard_proto_rawDescGZIP(), []int{10}
} }
func (x *CommentRsp) GetIdPackage() uint64 { func (x *CommentRsp) GetIdPackage() uint64 {
@ -574,7 +692,7 @@ type CommentReq struct {
func (x *CommentReq) Reset() { func (x *CommentReq) Reset() {
*x = CommentReq{} *x = CommentReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_dashboard_proto_msgTypes[9] mi := &file_dashboard_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -587,7 +705,7 @@ func (x *CommentReq) String() string {
func (*CommentReq) ProtoMessage() {} func (*CommentReq) ProtoMessage() {}
func (x *CommentReq) ProtoReflect() protoreflect.Message { func (x *CommentReq) ProtoReflect() protoreflect.Message {
mi := &file_dashboard_proto_msgTypes[9] mi := &file_dashboard_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -600,7 +718,7 @@ func (x *CommentReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use CommentReq.ProtoReflect.Descriptor instead. // Deprecated: Use CommentReq.ProtoReflect.Descriptor instead.
func (*CommentReq) Descriptor() ([]byte, []int) { func (*CommentReq) Descriptor() ([]byte, []int) {
return file_dashboard_proto_rawDescGZIP(), []int{9} return file_dashboard_proto_rawDescGZIP(), []int{11}
} }
func (x *CommentReq) GetId() uint64 { func (x *CommentReq) GetId() uint64 {
@ -616,82 +734,91 @@ var file_dashboard_proto_rawDesc = []byte{
0x0a, 0x0f, 0x64, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x0a, 0x0f, 0x64, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x6f, 0x22, 0x2e, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0x12, 0x22, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70,
0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f,
0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x72, 0x22, 0x5f, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14,
0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x27, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74,
0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x07, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69,
0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6c, 0x73, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x17,
0x49, 0x73, 0x73, 0x75, 0x65, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x22, 0x84, 0x01,
0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 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, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,
0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21,
0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42,
0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x70, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x05, 0x49, 0x73, 0x73, 0x75, 0x65, 0x12, 0x17,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32,
0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04,
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12,
0x04, 0x64, 0x65, 0x73, 0x63, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x27, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52,
0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75,
0x6c, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x65, 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x22, 0x84,
0x01, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 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, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x21, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x70, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x05, 0x49, 0x73, 0x73, 0x75, 0x65, 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, 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20,
0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x65, 0x73,
0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01,
0x52, 0x04, 0x64, 0x65, 0x73, 0x63, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00,
0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 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, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02,
0x20, 0x00, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74,
0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12,
0x21, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04,
0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x64, 0x12, 0x21, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20,
0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x75, 0x70,
0x64, 0x61, 0x74, 0x65, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3c, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x50,
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,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32,
0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x47, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x65,
0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61,
0x00, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20,
0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x21, 0x00, 0x52, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74,
0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x22, 0x25, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x17,
0x64, 0x12, 0x21, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32,
0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x07, 0x75, 0x70, 0x64, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x32, 0xd1, 0x01, 0x0a, 0x10, 0x44, 0x61, 0x73, 0x68,
0x61, 0x74, 0x65, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0b,
0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3c, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x72,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52,
0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50,
0x74, 0x6f, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0a, 0x55,
0x61, 0x67, 0x65, 0x73, 0x22, 0x2f, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x02, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55,
0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2f, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
0x6e, 0x66, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x52, 0x65, 0x71, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x65, 0x6e, 0x74, 0x12, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x47, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43,
0x74, 0x52, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x22, 0x00, 0x42, 0x44, 0x5a, 0x42, 0x67,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x75,
0x52, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x64,
0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x67, 0x65, 0x6e,
0x25, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x65, 0x72, 0x61, 0x74, 0x65, 0x3b, 0x67, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x32, 0xd1, 0x01, 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, 0x34, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65,
0x6e, 0x74, 0x12, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65,
0x6e, 0x74, 0x52, 0x73, 0x70, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f,
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x22, 0x00, 0x42, 0x44, 0x5a, 0x42, 0x67, 0x6f,
0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x75, 0x6e,
0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x64, 0x61,
0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65,
0x72, 0x61, 0x74, 0x65, 0x3b, 0x67, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -706,34 +833,37 @@ func file_dashboard_proto_rawDescGZIP() []byte {
return file_dashboard_proto_rawDescData return file_dashboard_proto_rawDescData
} }
var file_dashboard_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_dashboard_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_dashboard_proto_goTypes = []interface{}{ var file_dashboard_proto_goTypes = []interface{}{
(*Package)(nil), // 0: proto.Package (*ErrorRsp)(nil), // 0: proto.ErrorRsp
(*Module)(nil), // 1: proto.Module (*Error)(nil), // 1: proto.Error
(*Issue)(nil), // 2: proto.Issue (*Package)(nil), // 2: proto.Package
(*Comment)(nil), // 3: proto.Comment (*Module)(nil), // 3: proto.Module
(*ListPackageReq)(nil), // 4: proto.ListPackageReq (*Issue)(nil), // 4: proto.Issue
(*ListPackageRsp)(nil), // 5: proto.ListPackageRsp (*Comment)(nil), // 5: proto.Comment
(*UpdateInfoPackageRsp)(nil), // 6: proto.UpdateInfoPackageRsp (*ListPackageReq)(nil), // 6: proto.ListPackageReq
(*UpdateInfoPackageReq)(nil), // 7: proto.UpdateInfoPackageReq (*ListPackageRsp)(nil), // 7: proto.ListPackageRsp
(*CommentRsp)(nil), // 8: proto.CommentRsp (*UpdateInfoPackageRsp)(nil), // 8: proto.UpdateInfoPackageRsp
(*CommentReq)(nil), // 9: proto.CommentReq (*UpdateInfoPackageReq)(nil), // 9: proto.UpdateInfoPackageReq
(*CommentRsp)(nil), // 10: proto.CommentRsp
(*CommentReq)(nil), // 11: proto.CommentReq
} }
var file_dashboard_proto_depIdxs = []int32{ var file_dashboard_proto_depIdxs = []int32{
1, // 0: proto.Package.modules:type_name -> proto.Module 1, // 0: proto.ErrorRsp.error:type_name -> proto.Error
2, // 1: proto.Package.issues:type_name -> proto.Issue 3, // 1: proto.Package.modules:type_name -> proto.Module
0, // 2: proto.ListPackageRsp.packages:type_name -> proto.Package 4, // 2: proto.Package.issues:type_name -> proto.Issue
4, // 3: proto.DashboardService.ListPackage:input_type -> proto.ListPackageReq 2, // 3: proto.ListPackageRsp.packages:type_name -> proto.Package
6, // 4: proto.DashboardService.UpdateInfo:input_type -> proto.UpdateInfoPackageRsp 6, // 4: proto.DashboardService.ListPackage:input_type -> proto.ListPackageReq
8, // 5: proto.DashboardService.AddComment:input_type -> proto.CommentRsp 8, // 5: proto.DashboardService.UpdateInfo:input_type -> proto.UpdateInfoPackageRsp
5, // 6: proto.DashboardService.ListPackage:output_type -> proto.ListPackageRsp 10, // 6: proto.DashboardService.AddComment:input_type -> proto.CommentRsp
7, // 7: proto.DashboardService.UpdateInfo:output_type -> proto.UpdateInfoPackageReq 7, // 7: proto.DashboardService.ListPackage:output_type -> proto.ListPackageRsp
9, // 8: proto.DashboardService.AddComment:output_type -> proto.CommentReq 9, // 8: proto.DashboardService.UpdateInfo:output_type -> proto.UpdateInfoPackageReq
6, // [6:9] is the sub-list for method output_type 11, // 9: proto.DashboardService.AddComment:output_type -> proto.CommentReq
3, // [3:6] is the sub-list for method input_type 7, // [7:10] is the sub-list for method output_type
3, // [3:3] is the sub-list for extension type_name 4, // [4:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension extendee 4, // [4:4] is the sub-list for extension type_name
0, // [0:3] is the sub-list for field type_name 4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
} }
func init() { file_dashboard_proto_init() } func init() { file_dashboard_proto_init() }
@ -743,7 +873,7 @@ func file_dashboard_proto_init() {
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_dashboard_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Package); i { switch v := v.(*ErrorRsp); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -755,7 +885,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Module); i { switch v := v.(*Error); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -767,7 +897,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Issue); i { switch v := v.(*Package); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -779,7 +909,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Comment); i { switch v := v.(*Module); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -791,7 +921,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListPackageReq); i { switch v := v.(*Issue); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -803,7 +933,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListPackageRsp); i { switch v := v.(*Comment); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -815,7 +945,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateInfoPackageRsp); i { switch v := v.(*ListPackageReq); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -827,7 +957,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateInfoPackageReq); i { switch v := v.(*ListPackageRsp); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -839,7 +969,7 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommentRsp); i { switch v := v.(*UpdateInfoPackageRsp); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -851,6 +981,30 @@ func file_dashboard_proto_init() {
} }
} }
file_dashboard_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_dashboard_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateInfoPackageReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dashboard_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommentRsp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dashboard_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommentReq); i { switch v := v.(*CommentReq); i {
case 0: case 0:
return &v.state return &v.state
@ -869,7 +1023,7 @@ func file_dashboard_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_dashboard_proto_rawDesc, RawDescriptor: file_dashboard_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 10, NumMessages: 12,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@ -35,6 +35,240 @@ var (
_ = sort.Sort _ = sort.Sort
) )
// Validate checks the field values on ErrorRsp 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 *ErrorRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ErrorRsp 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 ErrorRspMultiError, or nil
// if none found.
func (m *ErrorRsp) ValidateAll() error {
return m.validate(true)
}
func (m *ErrorRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if all {
switch v := interface{}(m.GetError()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ErrorRspValidationError{
field: "Error",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ErrorRspValidationError{
field: "Error",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ErrorRspValidationError{
field: "Error",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return ErrorRspMultiError(errors)
}
return nil
}
// ErrorRspMultiError is an error wrapping multiple validation errors returned
// by ErrorRsp.ValidateAll() if the designated constraints aren't met.
type ErrorRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ErrorRspMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ErrorRspMultiError) AllErrors() []error { return m }
// ErrorRspValidationError is the validation error returned by
// ErrorRsp.Validate if the designated constraints aren't met.
type ErrorRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ErrorRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ErrorRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ErrorRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ErrorRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ErrorRspValidationError) ErrorName() string { return "ErrorRspValidationError" }
// Error satisfies the builtin error interface
func (e ErrorRspValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sErrorRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ErrorRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ErrorRspValidationError{}
// Validate checks the field values on Error 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 *Error) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Error 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 ErrorMultiError, or nil if none found.
func (m *Error) ValidateAll() error {
return m.validate(true)
}
func (m *Error) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Code
// no validation rules for Title
// no validation rules for Uuid
// no validation rules for Details
if len(errors) > 0 {
return ErrorMultiError(errors)
}
return nil
}
// ErrorMultiError is an error wrapping multiple validation errors returned by
// Error.ValidateAll() if the designated constraints aren't met.
type ErrorMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ErrorMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ErrorMultiError) AllErrors() []error { return m }
// ErrorValidationError is the validation error returned by Error.Validate if
// the designated constraints aren't met.
type ErrorValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ErrorValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ErrorValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ErrorValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ErrorValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ErrorValidationError) ErrorName() string { return "ErrorValidationError" }
// Error satisfies the builtin error interface
func (e ErrorValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sError.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ErrorValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ErrorValidationError{}
// Validate checks the field values on Package with the rules defined in the // Validate checks the field values on Package with the rules defined in the
// proto definition for this message. If any rules are violated, the first // proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations. // error encountered is returned, or nil if there are no violations.

View File

@ -6,6 +6,8 @@ package go_generate
import ( import (
context "context" context "context"
_ "go.unistack.org/micro-client-http/v3"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server" server "go.unistack.org/micro/v3/server"
go_generate "go.unistack.org/unistack-org/pkgdash/proto/go_generate" go_generate "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
@ -74,5 +76,6 @@ func RegisterDashboardServiceServer(s server.Server, sh DashboardServiceServer,
} }
h := &dashboardServiceServer{sh} h := &dashboardServiceServer{sh}
var nopts []server.HandlerOption var nopts []server.HandlerOption
nopts = append(nopts, v3.HandlerEndpoints(DashboardServiceServerEndpoints))
return s.Handle(s.NewHandler(&DashboardService{h}, append(nopts, opts...)...)) return s.Handle(s.NewHandler(&DashboardService{h}, append(nopts, opts...)...))
} }

View File

@ -2,9 +2,14 @@ package service
import ( import (
"context" "context"
cmsstorage "go.unistack.org/cms-service/storage"
intcfg "go.unistack.org/unistack-org/pkgdash/config" intcfg "go.unistack.org/unistack-org/pkgdash/config"
"go.unistack.org/unistack-org/pkgdash/handler" "go.unistack.org/unistack-org/pkgdash/handler"
pbmicro "go.unistack.org/unistack-org/pkgdash/proto/micro" "go.unistack.org/unistack-org/pkgdash/handler/encoders"
"net/http"
//pbmicro "go.unistack.org/unistack-org/pkgdash/proto/micro"
"go.unistack.org/unistack-org/pkgdash/storage"
cmsservice "go.unistack.org/cms-service" cmsservice "go.unistack.org/cms-service"
grpcsrv "go.unistack.org/micro-server-grpc/v3" grpcsrv "go.unistack.org/micro-server-grpc/v3"
@ -49,7 +54,12 @@ func NewService(ctx context.Context) (micro.Service, error) {
micro.Config(cs...), micro.Config(cs...),
) )
h := handler.NewHandler(svc) writer, err := handler.NewWriter(encoders.NewJSONProto())
if err != nil {
logger.Fatalf(ctx, "failed init writer: %v", err)
}
h := handler.NewHandler(svc, writer)
if err := svc.Init( if err := svc.Init(
micro.AfterStart(func(_ context.Context) error { micro.AfterStart(func(_ context.Context) error {
@ -70,7 +80,7 @@ func NewService(ctx context.Context) (micro.Service, error) {
return err return err
} }
if err := svc.Server("grpc").Init( if err := svc.Server("http").Init(
server.Address(cfg.App.Address), server.Address(cfg.App.Address),
server.Name(cfg.Service.Name), server.Name(cfg.Service.Name),
server.Version(cfg.Service.Version), server.Version(cfg.Service.Version),
@ -84,7 +94,7 @@ func NewService(ctx context.Context) (micro.Service, error) {
level := logger.InfoLevel level := logger.InfoLevel
if v, ok := cfg.Logger.Level[cfg.Service.Name]; ok { if v, ok := cfg.Logger.Level[cfg.Service.Name]; ok {
level = logger.ParseLevel(v) level = logger.ParseLevel(v)
} else if v, ok := cfg.Logger.Level["all"]; ok { } else if v, ok = cfg.Logger.Level["all"]; ok {
level = logger.ParseLevel(v) level = logger.ParseLevel(v)
} }
log := logger.NewLogger( log := logger.NewLogger(
@ -93,11 +103,41 @@ func NewService(ctx context.Context) (micro.Service, error) {
) )
return svc.Init(micro.Logger(log)) return svc.Init(micro.Logger(log))
}), }),
micro.BeforeStart(func(_ context.Context) error {
var connstr string
if v, ok := cfg.Storage.DSN[cfg.Service.Name]; ok {
connstr = v
} else if v, ok = cfg.Storage.DSN["all"]; ok {
connstr = v
}
scheme, dsn, err := cmsstorage.StorageOptions(connstr)
if err != nil {
return err
}
db, dbok := cmsstorage.FromContext(svc.Options().Context)
if !dbok {
db, err = cmsstorage.NewStorage(scheme, dsn)
if err != nil {
return err
}
}
store, err := storage.NewStorage(scheme, db)
if err != nil {
return err
}
return svc.Init(micro.Context(cmsstorage.InterfaceNewContext(svc.Options().Context, store)))
}),
); err != nil { ); err != nil {
return nil, err return nil, err
} }
if err := pbmicro.RegisterDashboardServiceServer(mgsrv, h); err != nil { mux := http.NewServeMux()
mux.HandleFunc("/listPackage", h.ListPackage)
mux.HandleFunc("/updateInfo", h.UpdateInfo)
mux.HandleFunc("/addComment", h.AddComment)
if err = svc.Server().Handle(svc.Server().NewHandler(mux)); err != nil {
logger.Fatalf(ctx, "failed to register handler: %v", err) logger.Fatalf(ctx, "failed to register handler: %v", err)
} }

View File

@ -0,0 +1 @@
drop table if exists dashboard, package, module, issue, comment;

View File

@ -0,0 +1,37 @@
create table if not exists dashboard (
id serial not null unique primary key ,
"uniq_id" uuid not null unique default gen_random_uuid() ,
package integer
);
create table if not exists comment (
id serial not null unique primary key ,
text text ,
created timestamp not null default current_timestamp ,
updated timestamp
);
create table if not exists module (
id serial not null unique primary key ,
name varchar not null ,
version varchar not null
);
create table if not exists issue (
id serial not null unique primary key ,
--package integer references package(id) ,
modules integer[] ,
status integer default 0 ,
"desc" varchar
);
create table if not exists package (
id serial not null unique primary key ,
name varchar not null ,
url varchar ,
modules integer[] ,
issues integer[] ,
comments integer[]
);

View File

@ -0,0 +1,7 @@
package postgres
const (
queryListPackage = `
select * from package;
`
)

View File

@ -0,0 +1,83 @@
package postgres
import (
"database/sql"
"embed"
"errors"
"go.unistack.org/unistack-org/pkgdash/config"
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database/pgx"
"github.com/golang-migrate/migrate/v4/source/iofs"
)
const (
pathMigration = `migrations/postgres`
)
type Postgres struct {
db *sql.DB
fs embed.FS
}
func NewStorage(db *sql.DB) (interface{}, error) {
return &Postgres{db: db}, nil
}
func NewStorageFS(fs embed.FS) func(*sql.DB) (interface{}, error) {
return func(db *sql.DB) (interface{}, error) {
return &Postgres{db: db, fs: fs}, nil
}
}
func (s *Postgres) MigrateUp() error {
driver, err := pgx.WithInstance(s.db, &pgx.Config{
MigrationsTable: pgx.DefaultMigrationsTable,
DatabaseName: config.ServiceName,
})
if err != nil {
return err
}
source, err := iofs.New(s.fs, pathMigration)
if err != nil {
return err
}
// TODO: pass own logger
m, err := migrate.NewWithInstance("fs", source, config.ServiceName, driver)
if err != nil {
return err
}
if err = m.Up(); err != nil && !errors.Is(err, migrate.ErrNoChange) {
return err
}
return nil
}
func (s *Postgres) MigrateDown() error {
driver, err := pgx.WithInstance(s.db, &pgx.Config{
MigrationsTable: pgx.DefaultMigrationsTable,
DatabaseName: config.ServiceName,
})
if err != nil {
return err
}
source, err := iofs.New(s.fs, pathMigration)
if err != nil {
return err
}
// TODO: pass own logger
m, err := migrate.NewWithInstance("fs", source, config.ServiceName, driver)
if err != nil {
return err
}
if err = m.Down(); err != nil && !errors.Is(err, migrate.ErrNoChange) {
return err
}
return nil
}

32
storage/storage.go Normal file
View File

@ -0,0 +1,32 @@
package storage
import (
"context"
"database/sql"
"embed"
"go.unistack.org/unistack-org/pkgdash/models"
"go.unistack.org/unistack-org/pkgdash/storage/postgres"
cmsstorage "go.unistack.org/cms-service/storage"
)
//go:embed migrations
var fs embed.FS
var (
storages = cmsstorage.NewStorageInterface()
)
func init() {
storages.RegisterStorage("postgres", postgres.NewStorageFS(fs))
}
type Storage interface {
cmsstorage.Migrator
List(ctx context.Context) ([]*models.Package, error)
}
func NewStorage(name string, db *sql.DB) (interface{}, error) {
return storages.NewStorage(name, db)
}