chanched handlers

This commit is contained in:
Денис Евстигнеев 2023-08-12 19:26:50 +03:00
parent 85f4b92fa7
commit 17a09f7fb3
28 changed files with 503 additions and 1001 deletions

View File

@ -2,13 +2,26 @@ package main
import (
"context"
"os"
"os/signal"
"syscall"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/unistack-org/pkgdash/service"
)
func main() {
ctx := context.Background()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
go func() {
sig := <-ch
logger.Infof(ctx, "handle signal %v, exiting", sig)
cancel()
}()
svc, err := service.NewService(ctx)
if err != nil {

View File

@ -1,22 +1,20 @@
package config
import service "go.unistack.org/cms-service"
type App struct {
Address string `flag:"name=pkgdash.address,desc='listen address',default='127.0.0.1:8080'"`
Name string
Version string
}
type Config struct {
App *App
Storage *service.ConfigStorage
Logger *service.ConfigLogger
Service *service.ConfigService
Core *service.ConfigCore
App *App
Address string `flag:"name=pkgdash.address,desc='listen address',default='127.0.0.1:8080'"`
StorageDSN map[string]string `flag:"name=storage.dsn,desc='components storage dsn',default='all=sqlite+file:database.db'"`
LogLevel string `flag:"name=logger.level,desc='logging level',default='info'"`
}
func NewConfig() *Config {
return &Config{
Service: &service.ConfigService{
App: &App{
Name: ServiceName,
Version: ServiceVersion,
},

14
go.mod
View File

@ -12,9 +12,9 @@ require (
github.com/mattn/go-sqlite3 v1.14.16
github.com/pkg/errors v0.9.1
go.unistack.org/cms-service v0.0.1
go.unistack.org/micro-client-http/v4 v4.0.2
go.unistack.org/micro-config-flag/v3 v3.8.9
go.unistack.org/micro-config-flag/v4 v4.0.2
go.unistack.org/micro-proto/v4 v4.0.1
go.unistack.org/micro-server-http/v3 v3.11.6
go.unistack.org/micro-server-http/v4 v4.0.9
go.unistack.org/micro/v4 v4.0.6
go.unistack.org/protoc-gen-go-micro/v4 v4.0.5
@ -23,6 +23,11 @@ require (
google.golang.org/protobuf v1.31.0
)
require (
go.unistack.org/micro-client-http/v3 v3.9.3
go.unistack.org/micro/v3 v3.10.18
)
require (
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
@ -40,7 +45,7 @@ require (
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530 // indirect
github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451 // indirect
@ -69,10 +74,9 @@ require (
go.unistack.org/micro-codec-yaml/v3 v3.10.0 // indirect
go.unistack.org/micro-config-env/v3 v3.8.5 // 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-service/v3 v3.8.1 // indirect
go.unistack.org/micro-proto/v3 v3.3.1 // indirect
go.unistack.org/micro-server-http/v3 v3.11.6 // indirect
go.unistack.org/micro/v3 v3.10.18 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/net v0.12.0 // indirect

10
go.sum
View File

@ -579,8 +579,8 @@ github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
@ -1020,8 +1020,8 @@ go.unistack.org/cms-service v0.0.1 h1:XKKZqjQD3ViPGRzjadnVX94wQlKcWxompZac9YTeTj
go.unistack.org/cms-service v0.0.1/go.mod h1:3apbDEEgmoPfnPRpzgN40fCqbn/BdfXDk/Hvly8+bGk=
go.unistack.org/micro-broker-service/v3 v3.8.2 h1:K30wBLsoLO0WbD9rhPi8S8asU9pfes/M2X9tX9HLr24=
go.unistack.org/micro-broker-service/v3 v3.8.2/go.mod h1:qTlBl4vdJSl66SFIjdjOWFWKO0BFQ2ImbwiPCti/H8M=
go.unistack.org/micro-client-http/v4 v4.0.2 h1:0xsm2RCRWMfb1moeXQQ220uz52XE0R/PZvM9was/4lM=
go.unistack.org/micro-client-http/v4 v4.0.2/go.mod h1:Z9QT/upeqrp/rXVkL0lk6AzrkTdes0W3QlFlZ+ytkqM=
go.unistack.org/micro-client-http/v3 v3.9.3 h1:5AicVsSwzAbIa1mpi99g5JhhDakUkgMV6e4F/Xyu3jI=
go.unistack.org/micro-client-http/v3 v3.9.3/go.mod h1:3zB0iVaYhG/xi0r/YvyTE422dOOOx1PAaiWlD2GSBlM=
go.unistack.org/micro-codec-yaml/v3 v3.10.0 h1:cnNiWQZ3F+jsCX9DhEHBdIw8CjBItxb+TrKGGdlQ8F8=
go.unistack.org/micro-codec-yaml/v3 v3.10.0/go.mod h1:UzwC3QZZ6+PgKSudlGZNLkugXzOFkp3sxhs/CctEwBY=
go.unistack.org/micro-config-env/v3 v3.8.5 h1:k0BKpQflJ9mutzK//VcYw4XAKlKHTvg2GtkHTrEjbko=
@ -1030,6 +1030,8 @@ go.unistack.org/micro-config-file/v3 v3.8.3 h1:yoAyDtmWutlUkVgFUtc7JhwCX7H/2Jz0n
go.unistack.org/micro-config-file/v3 v3.8.3/go.mod h1:dl+MQ27/P41+hINmSrZFltDSDYP1y2LItIDYb2jHFog=
go.unistack.org/micro-config-flag/v3 v3.8.9 h1:I4eoJVV28CpxQvQ63TJ1fqK5JcV1gHmOZPveT2Vl5Iw=
go.unistack.org/micro-config-flag/v3 v3.8.9/go.mod h1:eWI90dcZh5AOhkd83fF0KY17ea/DZPebkJ8K61yky+8=
go.unistack.org/micro-config-flag/v4 v4.0.2 h1:qoDpT/H8a8TYZS9ucoNC0bLhNdp+UFlhnRWOuqIKAyo=
go.unistack.org/micro-config-flag/v4 v4.0.2/go.mod h1:s0AYvz8rRtMHG2tkXoSmF8xFuHG12x3v1NERdMHDdiQ=
go.unistack.org/micro-config-service/v3 v3.8.1 h1:Q+RPWCb88VGz5+EQUx45Xeysf+Mon9Q2IvqCF3e8LZM=
go.unistack.org/micro-config-service/v3 v3.8.1/go.mod h1:KdZJEuYwninyT04ysFkgEQa3OaMRa0kSQVPQHlumQoA=
go.unistack.org/micro-proto/v3 v3.3.1 h1:nQ0MtWvP2G3QrpOgawVOPhpZZYkq6umTGDqs8FxJYIo=

View File

@ -1,26 +0,0 @@
package encoders
import (
"encoding/json"
"net/http"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"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

@ -1,51 +0,0 @@
package encoders
import (
"github.com/pkg/errors"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"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
}

View File

@ -1,6 +1,16 @@
package handler
import "github.com/pkg/errors"
import (
"github.com/google/uuid"
"github.com/pkg/errors"
pb "go.unistack.org/unistack-org/pkgdash/proto"
)
const (
badRequest = `Bad Requet`
internalError = `Internal Error`
notFound = `Source Not Found`
)
type UnmarshalError struct {
err error
@ -18,16 +28,15 @@ 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})
func NewInternalError(err error) *pb.ErrorRsp {
return &pb.ErrorRsp{
Error: &pb.Error{
Code: internalErrorCode,
Title: internalError,
Uuid: uuid.New().String(),
Details: err.Error(),
},
}
}
type ParametersMissingError struct {
@ -42,26 +51,24 @@ func NewParametersMissingError(err error) error {
return errors.WithStack(&ParametersMissingError{Err: err})
}
type NotFoundError struct {
Err error
func NewNotFoundError(err error) *pb.ErrorRsp {
return &pb.ErrorRsp{
Error: &pb.Error{
Code: notFoundErrorCode,
Title: notFound,
Uuid: uuid.New().String(),
Details: 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})
func NewValidationError(err error) *pb.ErrorRsp {
return &pb.ErrorRsp{
Error: &pb.Error{
Code: badRequestCode,
Title: badRequest,
Uuid: uuid.New().String(),
Details: err.Error(),
},
}
}

View File

@ -2,20 +2,18 @@ package handler
import (
"context"
"encoding/json"
"io"
"net/http"
"net/url"
"database/sql"
"errors"
cmsstorage "go.unistack.org/cms-service/storage"
httpsrv "go.unistack.org/micro-server-http/v4"
"go.unistack.org/micro/v4"
"go.unistack.org/micro/v4/errors"
"go.unistack.org/unistack-org/pkgdash/config"
pb "go.unistack.org/unistack-org/pkgdash/proto"
cligit "go.unistack.org/unistack-org/pkgdash/service/client_git"
"go.unistack.org/unistack-org/pkgdash/storage"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/emptypb"
"net/http"
)
type Handler struct {
@ -30,119 +28,80 @@ type Handler struct {
chanUrl chan *pb.AddPackageReq
}
func (h *Handler) ListPackage(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
func (h *Handler) ListPackage(ctx context.Context, _ *emptypb.Empty, rsp *pb.ListPackageRsp) error {
logger := h.svc.Logger()
logger.Debug(ctx, "Start getListPackage")
dbRsp, err := h.store.ListPackage(ctx)
if err != nil {
logger.Errorf(ctx, "error db response: %v", err)
h.writer.Response(ctx, w, err)
return
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
return httpsrv.SetError(NewInternalError(err))
}
rsp := new(pb.ListPackageRsp)
//rsp = new(pb.ListPackageRsp)
rsp.Packages = dbRsp.Decode()
logger.Debug(ctx, "Success finish getListPackage")
h.writer.Response(ctx, w, rsp)
return nil
}
func (h *Handler) UpdatePackage(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
func (h *Handler) UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq, rsp *pb.UpdatePackageRsp) error {
logger := h.svc.Logger()
logger.Debug(ctx, "Start UpdatePackage")
defer r.Body.Close()
all, err := io.ReadAll(r.Body)
if err != nil {
if err := req.Validate(); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
return httpsrv.SetError(NewValidationError(err))
}
req := new(pb.UpdatePackageReq)
if err = h.Unmarshal(all, req); err != nil {
if err := h.store.UpdatePackage(ctx, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewUnmarshalError(err))
return
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
return httpsrv.SetError(NewInternalError(err))
}
if err = req.Validate(); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewValidationError(err))
return
}
if err = h.store.UpdatePackage(ctx, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
}
rsp.Id = req.Id
logger.Debug(ctx, "Success finish UpdatePackage")
return nil
}
func (h *Handler) AddComment(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
func (h *Handler) AddComment(ctx context.Context, req *pb.AddCommentReq, rsp *pb.AddCommentRsp) error {
logger := h.svc.Logger()
logger.Debug(ctx, "Start AddComment")
defer r.Body.Close()
all, err := io.ReadAll(r.Body)
err := req.Validate()
if err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
return httpsrv.SetError(NewValidationError(err))
}
req := new(pb.AddCommentReq)
if err = h.Unmarshal(all, req); err != nil {
if rsp.Id, err = h.store.AddComment(ctx, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewUnmarshalError(err))
return
}
if err = req.Validate(); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewValidationError(err))
return
}
if err = h.store.AddComment(ctx, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
if errors.Is(err, sql.ErrNoRows) {
httpsrv.SetRspCode(ctx, http.StatusNotFound)
return httpsrv.SetError(NewNotFoundError(err))
}
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
return httpsrv.SetError(NewInternalError(err))
}
logger.Debug(ctx, "Success finish addComment")
return nil
}
func (h *Handler) AddPackage(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
func (h *Handler) AddPackage(ctx context.Context, req *pb.AddPackageReq, rsp *pb.AddPackageRsp) error {
logger := h.svc.Logger()
logger.Debug(ctx, "Start AddPackage")
defer r.Body.Close()
all, err := io.ReadAll(r.Body)
err := req.Validate()
if err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
}
req := new(pb.AddPackageReq)
if err = h.Unmarshal(all, req); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewUnmarshalError(err))
return
}
if err = req.Validate(); err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewValidationError(err))
return
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
return httpsrv.SetError(NewValidationError(err))
}
if h.git.IsClose() {
@ -151,69 +110,40 @@ func (h *Handler) AddPackage(w http.ResponseWriter, r *http.Request) {
h.chanUrl <- req
}
rsp.Status = "Sent"
logger.Debug(ctx, "Success finish addPackage")
return nil
}
func (h *Handler) GetModule(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
func (h *Handler) GetModule(ctx context.Context, req *pb.GetModuleReq, rsp *pb.GetModuleRsp) error {
logger := h.svc.Logger()
logger.Debug(ctx, "Start GetModule")
req := new(pb.GetModuleReq)
if err := URLValuesToProto(r.URL.Query(), req); err != nil {
logger.Errorf(ctx, "Required parameter missing: %v", err)
h.writer.Response(ctx, w, err)
return
}
modules, err := h.store.GetModule(ctx, req)
if err != nil {
logger.Error(ctx, err)
h.writer.Response(ctx, w, NewInternalError(err))
return
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
return httpsrv.SetError(NewInternalError(err))
}
rsp := &pb.GetModuleRsp{Modules: modules.Decode()}
h.writer.Response(ctx, w, rsp)
rsp.Modules = modules.Decode()
logger.Debug(ctx, "Success finish getModule")
}
func URLValuesToProto(vals url.Values, msg proto.Message) error {
params := make(map[string]interface{})
var err error
for k, v := range vals {
if len(v) == 0 {
continue
}
switch k {
case "id[]":
params[k] = v
default:
params[k] = v[0]
}
}
b, err := json.Marshal(params)
if err != nil {
return NewUnmarshalError(err)
}
if err = protojson.Unmarshal(b, msg); err != nil {
return NewUnmarshalError(err)
}
return nil
}
func NewHandler(svc micro.Service, w writer, client cligit.Client) *Handler {
func NewHandler(svc micro.Service, client cligit.Client) *Handler {
h := &Handler{
svc: svc,
writer: w,
git: client,
svc: svc,
git: client,
}
h.EmitUnpopulated = true
h.UseProtoNames = false
return h
}
// TODO add conn db
func (h *Handler) Init(ctx context.Context) error {
store := cmsstorage.InterfaceFromContext(h.svc.Options().Context)
if store == nil {

View File

@ -1,43 +0,0 @@
FROM golang:1.19-bullseye
RUN mkdir /build
WORKDIR /build
RUN apt-get update && apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev
ENV PATH=${PATH}:${GOBIN}
ENV GEN_VALIDATE=github.com/envoyproxy/protoc-gen-validate@v1.0.2
ENV GOOGLEAPIS=github.com/google/googleapis@v0.0.0-20200324113624-36c0febd0fa7
ENV GRPC_GATEWAY=github.com/grpc-ecosystem/grpc-gateway@v1.16.0
RUN go install ${GEN_VALIDATE}
RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v1.16.0 && \
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v1.16.0 && \
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
RUN go install go.unistack.org/protoc-gen-go-micro/v3@latest
RUN go mod init proto
RUN go get ${GOOGLEAPIS} && \
go get ${GRPC_GATEWAY} && \
go get google.golang.org/grpc@v1.57.0 && \
go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway && \
go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 && \
go get google.golang.org/protobuf/cmd/protoc-gen-go && \
go get go.unistack.org/micro-proto/v3@v3.3.1
CMD rm -rf go_generate && \
protoc \
--validate_out=lang=go:. \
--go-micro_out=debug=true,components="micro|http":. \
--go_out=. \
--grpc-gateway_out=. \
--proto_path=/go/pkg/mod/go.unistack.org/micro-proto/v3@v3.3.1 \
-I=./ \
-I=/usr/include \
-I=/go/pkg/mod/${GEN_VALIDATE} \
-I=/go/pkg/mod/${GOOGLEAPIS} \
-I=/go/pkg/mod/${GRPC_GATEWAY} \
./*.proto

View File

@ -1,7 +0,0 @@
#New version of proto Makefile and Dockerfile can be found
#at https://qcm-git.mbrd.ru/service-platform/examples/makefile
.PHONY: proto
proto:
docker build -t proto:latest .
docker run --rm --name=proto -v `pwd`:/build proto:latest

View File

@ -1,71 +0,0 @@
syntax = "proto3";
package proto;
option go_package = "./go_generate;go_generate";
import "validate/validate.proto";
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 {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
string name = 2 [(validate.rules).string.min_len = 1];
string url = 3 [(validate.rules).string.min_len = 1];
repeated Module modules = 4;
repeated Issue issues = 5;
};
message Module {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
string name = 2 [(validate.rules).string.min_len = 1];
string version = 3 [(validate.rules).string.min_len = 1];
uint64 package = 4 [(validate.rules).uint64.gt = 0];
}
message Issue {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
uint64 status = 2 [(validate.rules).uint64.gt = 0];
string desc = 3 [(validate.rules).string.min_len = 1];
uint64 package = 4 [(validate.rules).uint64.gt = 0];
repeated uint64 modules = 5;
}
message Comment {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
uint64 package = 2 [(validate.rules).uint64.gt = 0];
string text = 3;
uint64 created = 4 [(validate.rules).uint64.gt = 0];
uint64 updated = 5 [(validate.rules).uint64.gt = 0];
}
message ListPackageReq {}
message ListPackageRsp{
repeated Package packages = 1;
}
message UpdateInfoPackageRsp {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
}
message UpdateInfoPackageReq {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
}
message CommentRsp {
uint64 idPackage = 1 [(validate.rules).uint64.gt = 0];
string text = 2;
}
message CommentReq {
uint64 id = 1 [(validate.rules).uint64.gt = 0];
}

View File

@ -1,42 +0,0 @@
syntax = "proto3";
package proto;
option go_package = "./go_generate;go_generate";
import "dashboard.proto";
import "google/api/annotations.proto";
import "protoc-gen-swagger/options/annotations.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
info: {
title: "service-platform/product-services/mts-money/gateway-proto",
version: "0";
};
consumes: "application/json";
produces: "application/json";
};
service DashboardService {
rpc ListPackage(ListPackageReq) returns (ListPackageRsp) {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
operation_id: "ListPackage";
responses: {
key: "default";
value: {
description: "Error response";
schema: {
json_schema: {
ref: ".go_generate.ErrorRsp";
}
}
}
}
};
option (google.api.http) = {
get: "/listPackage";
};
};
rpc UpdateInfo(UpdateInfoPackageRsp) returns (UpdateInfoPackageReq) {};
rpc AddComment(CommentRsp) returns (CommentReq) {};
};

View File

@ -1,14 +0,0 @@
#!/bin/sh -ex
PROTO_ARGS=" \
--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) \
--go_out=paths=source_relative:go_generate \
--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
"
find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" -or -name "Dockerfile" -or -name "Makefile" \) -delete
mkdir -p micro go_generate && \
protoc -I. $PROTO_ARGS ./*.proto || \
find . -not \( -name "*.sh" -or -name "*.proto" -or -name "generate.go" -or -name "Dockerfile" -or -name "Makefile" \) -delete

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: pkgdash.proto
@ -12,7 +12,7 @@ import (
_ "go.unistack.org/micro-proto/v4/openapiv3"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
@ -556,11 +556,11 @@ type UpdatePackageReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id *wrapperspb.UInt64Value `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name *wrapperspb.StringValue `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Url *wrapperspb.StringValue `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
Modules []uint64 `protobuf:"varint,4,rep,packed,name=modules,proto3" json:"modules,omitempty"`
Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"`
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
Modules []uint64 `protobuf:"varint,4,rep,packed,name=modules,proto3" json:"modules,omitempty"`
Issues []uint64 `protobuf:"varint,5,rep,packed,name=issues,proto3" json:"issues,omitempty"`
}
func (x *UpdatePackageReq) Reset() {
@ -595,25 +595,25 @@ func (*UpdatePackageReq) Descriptor() ([]byte, []int) {
return file_pkgdash_proto_rawDescGZIP(), []int{8}
}
func (x *UpdatePackageReq) GetId() *wrapperspb.UInt64Value {
func (x *UpdatePackageReq) GetId() uint64 {
if x != nil {
return x.Id
}
return nil
return 0
}
func (x *UpdatePackageReq) GetName() *wrapperspb.StringValue {
func (x *UpdatePackageReq) GetName() string {
if x != nil {
return x.Name
}
return nil
return ""
}
func (x *UpdatePackageReq) GetUrl() *wrapperspb.StringValue {
func (x *UpdatePackageReq) GetUrl() string {
if x != nil {
return x.Url
}
return nil
return ""
}
func (x *UpdatePackageReq) GetModules() []uint64 {
@ -737,8 +737,8 @@ type AddCommentReq struct {
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"`
IdPackage uint64 `protobuf:"varint,1,opt,name=idPackage,proto3" json:"idPackage,omitempty"`
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
}
func (x *AddCommentReq) Reset() {
@ -773,11 +773,11 @@ func (*AddCommentReq) Descriptor() ([]byte, []int) {
return file_pkgdash_proto_rawDescGZIP(), []int{11}
}
func (x *AddCommentReq) GetIdPackage() *wrapperspb.UInt64Value {
func (x *AddCommentReq) GetIdPackage() uint64 {
if x != nil {
return x.IdPackage
}
return nil
return 0
}
func (x *AddCommentReq) GetText() string {
@ -839,9 +839,9 @@ type AddPackageReq struct {
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"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
Modules []uint64 `protobuf:"varint,3,rep,packed,name=modules,proto3" json:"modules,omitempty"`
}
func (x *AddPackageReq) Reset() {
@ -876,18 +876,18 @@ func (*AddPackageReq) Descriptor() ([]byte, []int) {
return file_pkgdash_proto_rawDescGZIP(), []int{13}
}
func (x *AddPackageReq) GetName() *wrapperspb.StringValue {
func (x *AddPackageReq) GetName() string {
if x != nil {
return x.Name
}
return nil
return ""
}
func (x *AddPackageReq) GetUrl() *wrapperspb.StringValue {
func (x *AddPackageReq) GetUrl() string {
if x != nil {
return x.Url
}
return nil
return ""
}
func (x *AddPackageReq) GetModules() []uint64 {
@ -901,6 +901,8 @@ type AddPackageRsp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
}
func (x *AddPackageRsp) Reset() {
@ -935,6 +937,13 @@ func (*AddPackageRsp) Descriptor() ([]byte, []int) {
return file_pkgdash_proto_rawDescGZIP(), []int{14}
}
func (x *AddPackageRsp) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
type GetModuleReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1038,77 +1047,71 @@ var file_pkgdash_proto_rawDesc = []byte{
0x1b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x30, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73,
0x70, 0x12, 0x24, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0e, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72,
0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x5f, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72,
0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75,
0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0xa8, 0x01, 0x0a, 0x07, 0x50, 0x61, 0x63,
0x6b, 0x61, 0x67, 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, 0x19, 0x0a, 0x03, 0x75, 0x72,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01,
0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73,
0x18, 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, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65,
0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65,
0x6e, 0x74, 0x73, 0x22, 0xb0, 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, 0x12, 0x2a, 0x0a, 0x0c, 0x6c, 0x61,
0x73, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x56,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 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, 0x3e, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74,
0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x08, 0x70, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70,
0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 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, 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, 0x64, 0x12, 0x3a, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x12, 0x38, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42,
0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x30, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0x12, 0x24,
0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x22, 0x5f, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a,
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64,
0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65,
0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0xa8, 0x01, 0x0a, 0x07, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67,
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, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75,
0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 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, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73,
0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73,
0x22, 0xb0, 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, 0x12, 0x2a, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa,
0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 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, 0x3e, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61,
0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6b, 0x67, 0x64,
0x61, 0x73, 0x68, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x08, 0x70, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52,
0x02, 0x69, 0x64, 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, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa,
0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 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,
@ -1118,80 +1121,76 @@ var file_pkgdash_proto_rawDesc = []byte{
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x19, 0x0a, 0x03, 0x70, 0x6b, 0x67, 0x18,
0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x03,
0x70, 0x6b, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x69, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f,
0x6d, 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, 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, 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, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x03, 0x75, 0x72,
0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52,
0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18,
0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x0f,
0x0a, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22,
0x1e, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22,
0x39, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x12,
0x29, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x0f, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x32, 0xa9, 0x05, 0x0a, 0x0e, 0x50,
0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x80, 0x01,
0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x17, 0x2e,
0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22,
0x3f, 0xaa, 0x84, 0x9e, 0x03, 0x26, 0x2a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64,
0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9,
0x01, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73,
0x12, 0x8c, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61,
0x67, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e,
0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x45, 0xaa, 0x84, 0x9e, 0x03, 0x25, 0x2a,
0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x17, 0x0a, 0x15, 0x12,
0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x15, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f,
0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x01, 0x2a, 0x12,
0x8c, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16,
0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d,
0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68,
0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x22, 0x4e,
0xaa, 0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,
0x74, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73,
0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x1e,
0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x7b, 0x70,
0x6b, 0x67, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x7e,
0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x16, 0x2e, 0x70,
0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67,
0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41,
0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x40, 0xaa, 0x84,
0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x42,
0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e,
0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x10, 0x22, 0x0b,
0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x76,
0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x6b,
0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52,
0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x22, 0x3b, 0xaa, 0x84, 0x9e, 0x03, 0x24,
0x2a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12,
0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x36, 0x5a, 0x34, 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, 0x3b, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x4a, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f,
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x25, 0x0a, 0x09, 0x69, 0x64, 0x50, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04,
0x32, 0x02, 0x20, 0x00, 0x52, 0x09, 0x69, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
0x65, 0x78, 0x74, 0x22, 0x28, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,
0x74, 0x52, 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, 0x61, 0x0a,
0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1b,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42,
0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x03, 0x75,
0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10,
0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73,
0x22, 0x30, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73,
0x70, 0x12, 0x1f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x22, 0x1e, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52,
0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x02,
0x69, 0x64, 0x22, 0x39, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52,
0x73, 0x70, 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x32, 0xa7, 0x05,
0x0a, 0x0e, 0x50, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x12, 0x7f, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12,
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73,
0x68, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70,
0x22, 0x3f, 0xaa, 0x84, 0x9e, 0x03, 0x26, 0x2a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63,
0x6b, 0x61, 0x67, 0x65, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67,
0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff,
0xf9, 0x01, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
0x73, 0x12, 0x8c, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b,
0x61, 0x67, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x19,
0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50,
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x45, 0xaa, 0x84, 0x9e, 0x03, 0x25,
0x2a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x17, 0x0a, 0x15,
0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72,
0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10,
0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x7b, 0x69, 0x64, 0x7d,
0x12, 0x8c, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d,
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73,
0x68, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x22,
0x4e, 0xaa, 0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65,
0x6e, 0x74, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61,
0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01,
0x1e, 0x3a, 0x01, 0x2a, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67,
0x65, 0x2f, 0x7b, 0x70, 0x6b, 0x67, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x7e, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x16, 0x2e,
0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61,
0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e,
0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x40, 0xaa,
0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68,
0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x10, 0x3a,
0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12,
0x76, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x70,
0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65,
0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x22, 0x3b, 0xaa, 0x84, 0x9e, 0x03,
0x24, 0x2a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x17, 0x0a, 0x15,
0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72,
0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x36, 0x5a, 0x34, 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, 0x3b, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1208,51 +1207,44 @@ func file_pkgdash_proto_rawDescGZIP() []byte {
var file_pkgdash_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
var file_pkgdash_proto_goTypes = []interface{}{
(*ErrorRsp)(nil), // 0: pkgdash.ErrorRsp
(*Error)(nil), // 1: pkgdash.Error
(*Package)(nil), // 2: pkgdash.Package
(*Module)(nil), // 3: pkgdash.Module
(*Issue)(nil), // 4: pkgdash.Issue
(*Comment)(nil), // 5: pkgdash.Comment
(*ListPackageReq)(nil), // 6: pkgdash.ListPackageReq
(*ListPackageRsp)(nil), // 7: pkgdash.ListPackageRsp
(*UpdatePackageReq)(nil), // 8: pkgdash.UpdatePackageReq
(*UpdatePackageRsp)(nil), // 9: pkgdash.UpdatePackageRsp
(*CommentReq)(nil), // 10: pkgdash.CommentReq
(*AddCommentReq)(nil), // 11: pkgdash.AddCommentReq
(*AddCommentRsp)(nil), // 12: pkgdash.AddCommentRsp
(*AddPackageReq)(nil), // 13: pkgdash.AddPackageReq
(*AddPackageRsp)(nil), // 14: pkgdash.AddPackageRsp
(*GetModuleReq)(nil), // 15: pkgdash.GetModuleReq
(*GetModuleRsp)(nil), // 16: pkgdash.GetModuleRsp
(*wrapperspb.UInt64Value)(nil), // 17: google.protobuf.UInt64Value
(*wrapperspb.StringValue)(nil), // 18: google.protobuf.StringValue
(*ErrorRsp)(nil), // 0: pkgdash.ErrorRsp
(*Error)(nil), // 1: pkgdash.Error
(*Package)(nil), // 2: pkgdash.Package
(*Module)(nil), // 3: pkgdash.Module
(*Issue)(nil), // 4: pkgdash.Issue
(*Comment)(nil), // 5: pkgdash.Comment
(*ListPackageReq)(nil), // 6: pkgdash.ListPackageReq
(*ListPackageRsp)(nil), // 7: pkgdash.ListPackageRsp
(*UpdatePackageReq)(nil), // 8: pkgdash.UpdatePackageReq
(*UpdatePackageRsp)(nil), // 9: pkgdash.UpdatePackageRsp
(*CommentReq)(nil), // 10: pkgdash.CommentReq
(*AddCommentReq)(nil), // 11: pkgdash.AddCommentReq
(*AddCommentRsp)(nil), // 12: pkgdash.AddCommentRsp
(*AddPackageReq)(nil), // 13: pkgdash.AddPackageReq
(*AddPackageRsp)(nil), // 14: pkgdash.AddPackageRsp
(*GetModuleReq)(nil), // 15: pkgdash.GetModuleReq
(*GetModuleRsp)(nil), // 16: pkgdash.GetModuleRsp
(*emptypb.Empty)(nil), // 17: google.protobuf.Empty
}
var file_pkgdash_proto_depIdxs = []int32{
1, // 0: pkgdash.ErrorRsp.error:type_name -> pkgdash.Error
2, // 1: pkgdash.ListPackageRsp.packages:type_name -> pkgdash.Package
17, // 2: pkgdash.UpdatePackageReq.id:type_name -> google.protobuf.UInt64Value
18, // 3: pkgdash.UpdatePackageReq.name:type_name -> google.protobuf.StringValue
18, // 4: pkgdash.UpdatePackageReq.url:type_name -> google.protobuf.StringValue
17, // 5: pkgdash.AddCommentReq.idPackage:type_name -> google.protobuf.UInt64Value
18, // 6: pkgdash.AddPackageReq.name:type_name -> google.protobuf.StringValue
18, // 7: pkgdash.AddPackageReq.url:type_name -> google.protobuf.StringValue
3, // 8: pkgdash.GetModuleRsp.modules:type_name -> pkgdash.Module
6, // 9: pkgdash.PkgdashService.ListPackage:input_type -> pkgdash.ListPackageReq
8, // 10: pkgdash.PkgdashService.UpdatePackage:input_type -> pkgdash.UpdatePackageReq
11, // 11: pkgdash.PkgdashService.AddComment:input_type -> pkgdash.AddCommentReq
13, // 12: pkgdash.PkgdashService.AddPackage:input_type -> pkgdash.AddPackageReq
15, // 13: pkgdash.PkgdashService.GetModule:input_type -> pkgdash.GetModuleReq
7, // 14: pkgdash.PkgdashService.ListPackage:output_type -> pkgdash.ListPackageRsp
9, // 15: pkgdash.PkgdashService.UpdatePackage:output_type -> pkgdash.UpdatePackageRsp
12, // 16: pkgdash.PkgdashService.AddComment:output_type -> pkgdash.AddCommentRsp
14, // 17: pkgdash.PkgdashService.AddPackage:output_type -> pkgdash.AddPackageRsp
16, // 18: pkgdash.PkgdashService.GetModule:output_type -> pkgdash.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
3, // 2: pkgdash.GetModuleRsp.modules:type_name -> pkgdash.Module
17, // 3: pkgdash.PkgdashService.ListPackage:input_type -> google.protobuf.Empty
8, // 4: pkgdash.PkgdashService.UpdatePackage:input_type -> pkgdash.UpdatePackageReq
11, // 5: pkgdash.PkgdashService.AddComment:input_type -> pkgdash.AddCommentReq
13, // 6: pkgdash.PkgdashService.AddPackage:input_type -> pkgdash.AddPackageReq
15, // 7: pkgdash.PkgdashService.GetModule:input_type -> pkgdash.GetModuleReq
7, // 8: pkgdash.PkgdashService.ListPackage:output_type -> pkgdash.ListPackageRsp
9, // 9: pkgdash.PkgdashService.UpdatePackage:output_type -> pkgdash.UpdatePackageRsp
12, // 10: pkgdash.PkgdashService.AddComment:output_type -> pkgdash.AddCommentRsp
14, // 11: pkgdash.PkgdashService.AddPackage:output_type -> pkgdash.AddPackageRsp
16, // 12: pkgdash.PkgdashService.GetModule:output_type -> pkgdash.GetModuleRsp
8, // [8:13] is the sub-list for method output_type
3, // [3:8] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_pkgdash_proto_init() }

View File

@ -89,6 +89,7 @@ func (m *ErrorRsp) validate(all bool) error {
if len(errors) > 0 {
return ErrorRspMultiError(errors)
}
return nil
}
@ -194,6 +195,7 @@ func (m *Error) validate(all bool) error {
if len(errors) > 0 {
return ErrorMultiError(errors)
}
return nil
}
@ -324,6 +326,7 @@ func (m *Package) validate(all bool) error {
if len(errors) > 0 {
return PackageMultiError(errors)
}
return nil
}
@ -476,6 +479,7 @@ func (m *Module) validate(all bool) error {
if len(errors) > 0 {
return ModuleMultiError(errors)
}
return nil
}
@ -617,6 +621,7 @@ func (m *Issue) validate(all bool) error {
if len(errors) > 0 {
return IssueMultiError(errors)
}
return nil
}
@ -760,6 +765,7 @@ func (m *Comment) validate(all bool) error {
if len(errors) > 0 {
return CommentMultiError(errors)
}
return nil
}
@ -858,6 +864,7 @@ func (m *ListPackageReq) validate(all bool) error {
if len(errors) > 0 {
return ListPackageReqMultiError(errors)
}
return nil
}
@ -991,6 +998,7 @@ func (m *ListPackageRsp) validate(all bool) error {
if len(errors) > 0 {
return ListPackageRspMultiError(errors)
}
return nil
}
@ -1087,10 +1095,10 @@ func (m *UpdatePackageReq) validate(all bool) error {
var errors []error
if m.GetId() == nil {
if m.GetId() <= 0 {
err := UpdatePackageReqValidationError{
field: "Id",
reason: "value is required",
reason: "value must be greater than 0",
}
if !all {
return err
@ -1098,39 +1106,10 @@ func (m *UpdatePackageReq) validate(all bool) error {
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetId()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdatePackageReqValidationError{
field: "Id",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdatePackageReqValidationError{
field: "Id",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetId()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdatePackageReqValidationError{
field: "Id",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.GetName() == nil {
if utf8.RuneCountInString(m.GetName()) < 1 {
err := UpdatePackageReqValidationError{
field: "Name",
reason: "value is required",
reason: "value length must be at least 1 runes",
}
if !all {
return err
@ -1138,39 +1117,10 @@ func (m *UpdatePackageReq) validate(all bool) error {
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetName()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdatePackageReqValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdatePackageReqValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdatePackageReqValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.GetUrl() == nil {
if utf8.RuneCountInString(m.GetUrl()) < 1 {
err := UpdatePackageReqValidationError{
field: "Url",
reason: "value is required",
reason: "value length must be at least 1 runes",
}
if !all {
return err
@ -1178,38 +1128,10 @@ func (m *UpdatePackageReq) validate(all bool) error {
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetUrl()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UpdatePackageReqValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UpdatePackageReqValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetUrl()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UpdatePackageReqValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return UpdatePackageReqMultiError(errors)
}
return nil
}
@ -1320,6 +1242,7 @@ func (m *UpdatePackageRsp) validate(all bool) error {
if len(errors) > 0 {
return UpdatePackageRspMultiError(errors)
}
return nil
}
@ -1432,6 +1355,7 @@ func (m *CommentReq) validate(all bool) error {
if len(errors) > 0 {
return CommentReqMultiError(errors)
}
return nil
}
@ -1527,10 +1451,10 @@ func (m *AddCommentReq) validate(all bool) error {
var errors []error
if m.GetIdPackage() == nil {
if m.GetIdPackage() <= 0 {
err := AddCommentReqValidationError{
field: "IdPackage",
reason: "value is required",
reason: "value must be greater than 0",
}
if !all {
return err
@ -1538,40 +1462,12 @@ func (m *AddCommentReq) validate(all bool) error {
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetIdPackage()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AddCommentReqValidationError{
field: "IdPackage",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AddCommentReqValidationError{
field: "IdPackage",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetIdPackage()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AddCommentReqValidationError{
field: "IdPackage",
reason: "embedded message failed validation",
cause: err,
}
}
}
// no validation rules for Text
if len(errors) > 0 {
return AddCommentReqMultiError(errors)
}
return nil
}
@ -1682,6 +1578,7 @@ func (m *AddCommentRsp) validate(all bool) error {
if len(errors) > 0 {
return AddCommentRspMultiError(errors)
}
return nil
}
@ -1778,10 +1675,10 @@ func (m *AddPackageReq) validate(all bool) error {
var errors []error
if m.GetName() == nil {
if utf8.RuneCountInString(m.GetName()) < 1 {
err := AddPackageReqValidationError{
field: "Name",
reason: "value is required",
reason: "value length must be at least 1 runes",
}
if !all {
return err
@ -1789,39 +1686,10 @@ func (m *AddPackageReq) validate(all bool) error {
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetName()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AddPackageReqValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AddPackageReqValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AddPackageReqValidationError{
field: "Name",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.GetUrl() == nil {
if utf8.RuneCountInString(m.GetUrl()) < 1 {
err := AddPackageReqValidationError{
field: "Url",
reason: "value is required",
reason: "value length must be at least 1 runes",
}
if !all {
return err
@ -1829,38 +1697,10 @@ func (m *AddPackageReq) validate(all bool) error {
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetUrl()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AddPackageReqValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AddPackageReqValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetUrl()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AddPackageReqValidationError{
field: "Url",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return AddPackageReqMultiError(errors)
}
return nil
}
@ -1957,9 +1797,21 @@ func (m *AddPackageRsp) validate(all bool) error {
var errors []error
if utf8.RuneCountInString(m.GetStatus()) < 1 {
err := AddPackageRspValidationError{
field: "Status",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AddPackageRspMultiError(errors)
}
return nil
}
@ -2059,6 +1911,7 @@ func (m *GetModuleReq) validate(all bool) error {
if len(errors) > 0 {
return GetModuleReqMultiError(errors)
}
return nil
}
@ -2191,6 +2044,7 @@ func (m *GetModuleRsp) validate(all bool) error {
if len(errors) > 0 {
return GetModuleRspMultiError(errors)
}
return nil
}

View File

@ -7,10 +7,10 @@ option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb";
import "api/annotations.proto";
import "openapiv3/annotations.proto";
import "validate/validate.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";
service PkgdashService {
rpc ListPackage(ListPackageReq) returns (ListPackageRsp) {
rpc ListPackage(google.protobuf.Empty) returns (ListPackageRsp) {
option (micro.openapiv3.openapiv3_operation) = {
operation_id: "ListPackage";
responses: {
@ -130,9 +130,9 @@ message ListPackageRsp{
}
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];
uint64 id = 1 [(validate.rules).uint64.gt = 0];
string name = 2 [(validate.rules).string.min_len = 1];
string url = 3 [(validate.rules).string.min_len = 1];
repeated uint64 modules = 4 ;
repeated uint64 issues = 5 ;
}
@ -146,7 +146,7 @@ message CommentReq {
}
message AddCommentReq {
google.protobuf.UInt64Value idPackage = 1 [(validate.rules).message.required = true];
uint64 idPackage = 1 [(validate.rules).uint64.gt = 0];
string text = 2;
}
@ -155,12 +155,14 @@ message AddCommentRsp {
}
message AddPackageReq {
google.protobuf.StringValue name = 1 [(validate.rules).message.required = true];
google.protobuf.StringValue url = 2 [(validate.rules).message.required = true];
string name = 1 [(validate.rules).string.min_len = 1];
string url = 2 [(validate.rules).string.min_len = 1];
repeated uint64 modules = 3;
}
message AddPackageRsp{}
message AddPackageRsp{
string status = 1 [(validate.rules).string.min_len = 1];
}
message GetModuleReq {
repeated uint64 id = 1 ;

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v4.0.2
// - protoc-gen-go-micro v3.10.3
// - protoc v4.23.4
// source: pkgdash.proto
@ -8,24 +8,64 @@ package pkgdashpb
import (
context "context"
_ "go.unistack.org/micro/v4/client"
options "go.unistack.org/micro/v4/options"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
var (
PkgdashServiceName = "PkgdashService"
)
var (
PkgdashServiceServerEndpoints = []v3.EndpointMetadata{
{
Name: "PkgdashService.ListPackage",
Path: "/v1/packages",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "PkgdashService.UpdatePackage",
Path: "/v1/package/{id}",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.AddComment",
Path: "/v1/package/{pkg}/comment",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.AddPackage",
Path: "/v1/package",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.GetModule",
Path: "/v1/module",
Method: "GET",
Body: "",
Stream: false,
},
}
)
type PkgdashServiceClient interface {
ListPackage(ctx context.Context, req *ListPackageReq, opts ...options.Option) (*ListPackageRsp, error)
UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error)
AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error)
AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error)
GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error)
ListPackage(ctx context.Context, req *emptypb.Empty, opts ...client.CallOption) (*ListPackageRsp, error)
UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...client.CallOption) (*UpdatePackageRsp, error)
AddComment(ctx context.Context, req *AddCommentReq, opts ...client.CallOption) (*AddCommentRsp, error)
AddPackage(ctx context.Context, req *AddPackageReq, opts ...client.CallOption) (*AddPackageRsp, error)
GetModule(ctx context.Context, req *GetModuleReq, opts ...client.CallOption) (*GetModuleRsp, error)
}
type PkgdashServiceServer interface {
ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error
ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error
UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error
AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error
AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error

View File

@ -1,59 +1,19 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v4.0.2
// protoc-gen-go-micro version: v3.10.3
// source: pkgdash.proto
package pkgdashpb
import (
context "context"
v41 "go.unistack.org/micro-client-http/v4"
v4 "go.unistack.org/micro-server-http/v4"
client "go.unistack.org/micro/v4/client"
options "go.unistack.org/micro/v4/options"
server "go.unistack.org/micro/v4/server"
v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
emptypb "google.golang.org/protobuf/types/known/emptypb"
http "net/http"
)
var (
PkgdashServiceServerEndpoints = []v4.EndpointMetadata{
{
Name: "PkgdashService.ListPackage",
Path: "/v1/packages",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "PkgdashService.UpdatePackage",
Path: "/v1/package/{id}",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.AddComment",
Path: "/v1/package/{pkg}/comment",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.AddPackage",
Path: "/v1/package",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.GetModule",
Path: "/v1/module",
Method: "GET",
Body: "",
Stream: false,
},
}
)
type pkgdashServiceClient struct {
c client.Client
name string
@ -63,15 +23,15 @@ func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient
return &pkgdashServiceClient{c: c, name: name}
}
func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *ListPackageReq, opts ...options.Option) (*ListPackageRsp, error) {
func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *emptypb.Empty, opts ...client.CallOption) (*ListPackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
v3.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodGet),
v41.Path("/v1/packages"),
v3.Method(http.MethodGet),
v3.Path("/v1/packages"),
)
rsp := &ListPackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.ListPackage", req), rsp, opts...)
@ -81,16 +41,16 @@ func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *ListPackage
return rsp, nil
}
func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error) {
func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...client.CallOption) (*UpdatePackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
v3.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodPost),
v41.Path("/v1/package/{id}"),
v41.Body("*"),
v3.Method(http.MethodPost),
v3.Path("/v1/package/{id}"),
v3.Body("*"),
)
rsp := &UpdatePackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.UpdatePackage", req), rsp, opts...)
@ -100,16 +60,16 @@ func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePac
return rsp, nil
}
func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error) {
func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentReq, opts ...client.CallOption) (*AddCommentRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
v3.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodPost),
v41.Path("/v1/package/{pkg}/comment"),
v41.Body("*"),
v3.Method(http.MethodPost),
v3.Path("/v1/package/{pkg}/comment"),
v3.Body("*"),
)
rsp := &AddCommentRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddComment", req), rsp, opts...)
@ -119,16 +79,16 @@ func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentRe
return rsp, nil
}
func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error) {
func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageReq, opts ...client.CallOption) (*AddPackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
v3.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodPost),
v41.Path("/v1/package"),
v41.Body("*"),
v3.Method(http.MethodPost),
v3.Path("/v1/package"),
v3.Body("*"),
)
rsp := &AddPackageRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.AddPackage", req), rsp, opts...)
@ -138,15 +98,15 @@ func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageRe
return rsp, nil
}
func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error) {
func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, opts ...client.CallOption) (*GetModuleRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
v3.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodGet),
v41.Path("/v1/module"),
v3.Method(http.MethodGet),
v3.Path("/v1/module"),
)
rsp := &GetModuleRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.GetModule", req), rsp, opts...)
@ -160,7 +120,7 @@ type pkgdashServiceServer struct {
PkgdashServiceServer
}
func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error {
func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error {
return h.PkgdashServiceServer.ListPackage(ctx, req, rsp)
}
@ -180,9 +140,9 @@ func (h *pkgdashServiceServer) GetModule(ctx context.Context, req *GetModuleReq,
return h.PkgdashServiceServer.GetModule(ctx, req, rsp)
}
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...options.Option) error {
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...server.HandlerOption) error {
type pkgdashService interface {
ListPackage(ctx context.Context, req *ListPackageReq, rsp *ListPackageRsp) error
ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error
UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error
AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error
AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error
@ -192,7 +152,7 @@ func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts
pkgdashService
}
h := &pkgdashServiceServer{sh}
var nopts []options.Option
nopts = append(nopts, v4.HandlerEndpoints(PkgdashServiceServerEndpoints))
return s.Handle(&PkgdashService{h}, append(nopts, opts...)...)
var nopts []server.HandlerOption
nopts = append(nopts, v31.HandlerEndpoints(PkgdashServiceServerEndpoints))
return s.Handle(s.NewHandler(&PkgdashService{h}, append(nopts, opts...)...))
}

View File

@ -2,20 +2,18 @@ package service
import (
"context"
"net/http"
cmsservice "go.unistack.org/cms-service"
cmsstorage "go.unistack.org/cms-service/storage"
httpsrv "go.unistack.org/micro-server-http/v4"
cmsstorage "go.unistack.org/cms-service/storage" // TODO
httpsrv "go.unistack.org/micro-server-http/v3"
"go.unistack.org/micro/v4"
"go.unistack.org/micro/v4/config"
microcfg "go.unistack.org/micro/v4/config"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/micro/v4/options"
"go.unistack.org/micro/v4/register"
"go.unistack.org/micro/v4/server"
intcfg "go.unistack.org/unistack-org/pkgdash/config"
"go.unistack.org/unistack-org/pkgdash/handler"
"go.unistack.org/unistack-org/pkgdash/handler/encoders"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"go.unistack.org/unistack-org/pkgdash/service/client_git"
"go.unistack.org/unistack-org/pkgdash/storage"
)
@ -23,51 +21,44 @@ import (
func NewService(ctx context.Context) (micro.Service, error) {
var reg register.Register
if ctx == nil {
ctx = context.Background()
}
cfg := intcfg.NewConfig()
cs := cmsservice.NewConfigLocal(cfg)
cs := microcfg.NewConfig(config.Struct(cfg))
// TODO
mgsrv := httpsrv.NewServer(
options.Register(reg),
)
svc := micro.NewService(
micro.Config(cs...),
micro.Config(cs),
)
writer, err := handler.NewWriter(encoders.NewJSONProto())
if err != nil {
logger.Fatalf(ctx, "failed init writer: %v", err)
}
h := handler.NewHandler(svc, client_git.NewClient(5))
h := handler.NewHandler(svc, writer, client_git.NewClient(5))
if err = svc.Init(
if err := svc.Init(
micro.AfterStart(func(_ context.Context) error {
return h.Init(svc.Options().Context)
}),
micro.BeforeStart(func(ctx context.Context) error {
if err = config.Load(ctx, cs, config.LoadOverride(true)); err != nil {
if err := config.Load(ctx, []config.Config{cs}, config.LoadOverride(true)); err != nil {
return err
}
if err = config.Validate(ctx, cfg); err != nil {
if err := config.Validate(ctx, cfg); err != nil {
return err
}
if err = svc.Init(
micro.Name(cfg.Service.Name),
micro.Version(cfg.Service.Version),
if err := svc.Init(
micro.Name(intcfg.ServiceName),
micro.Version(intcfg.ServiceVersion),
); err != nil {
return err
}
if err := svc.Server("http").Init(
options.Address(cfg.App.Address),
options.Name(cfg.Service.Name),
server.Version(cfg.Service.Version),
options.Address(cfg.Address),
options.Name(cfg.App.Name),
server.Version(cfg.App.Version),
); err != nil {
return err
}
@ -75,23 +66,17 @@ func NewService(ctx context.Context) (micro.Service, error) {
return nil
}),
micro.BeforeStart(func(_ context.Context) error {
level := logger.InfoLevel
if v, ok := cfg.Logger.Level[cfg.Service.Name]; ok {
level = logger.ParseLevel(v)
} else if v, ok = cfg.Logger.Level["all"]; ok {
level = logger.ParseLevel(v)
}
log := logger.NewLogger(
logger.WithLevel(level),
logger.WithLevel(logger.ParseLevel(cfg.LogLevel)),
logger.WithCallerSkipCount(3),
)
return svc.Init(micro.Logger(log))
}),
micro.BeforeStart(func(_ context.Context) error {
micro.BeforeStart(func(_ context.Context) error { // TODO
var connstr string
if v, ok := cfg.Storage.DSN[cfg.Service.Name]; ok {
if v, ok := cfg.StorageDSN[cfg.App.Name]; ok {
connstr = v
} else if v, ok = cfg.Storage.DSN["all"]; ok {
} else if v, ok = cfg.StorageDSN["all"]; ok {
connstr = v
}
scheme, dsn, err := cmsstorage.StorageOptions(connstr)
@ -115,15 +100,15 @@ func NewService(ctx context.Context) (micro.Service, error) {
return nil, err
}
mux := http.NewServeMux()
//mux := http.NewServeMux()
mux.HandleFunc("/listPackage", handler.Methods(http.MethodGet, h.ListPackage))
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))
//mux.HandleFunc("/listPackage", handler.Methods(http.MethodGet, h.ListPackage))
//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 {
if err := pb.RegisterPkgdashServiceServer(mgsrv, h); err != nil {
logger.Fatalf(ctx, "failed to register handler: %v", err)
}

View File

@ -24,5 +24,9 @@ insert into package(name, url, modules) values ($1, $2, $3);
insert into module(name, version, last_version) values
%s
returning id;
`
queryGetModule = `
select id, name, version, last_version from module
where id in %s ;
`
)

View File

@ -1,28 +0,0 @@
package postgres
const (
queryListPackage = `
select
id,
name,
url,
comments
--modules,
--issues,
from package;
`
queryAddComment = `
with insert_comm as (
insert into comment(text) values ($1) returning id
)
update package set comments = array_append(comments, (select * from insert_comm)) where id=$2;
`
queryAddPackage = `
insert into package(name, url, modules) values ($1, $2, $3);
`
queryInsMsgGetIDs = `
insert into module(name, version, last_version) values
%s
returning id;
`
)

View File

@ -6,7 +6,6 @@ import (
"embed"
"errors"
"fmt"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"strings"
"github.com/golang-migrate/migrate/v4"
@ -16,6 +15,7 @@ import (
"go.unistack.org/micro/v4/logger"
"go.unistack.org/unistack-org/pkgdash/config"
"go.unistack.org/unistack-org/pkgdash/models"
pb "go.unistack.org/unistack-org/pkgdash/proto"
)
const (
@ -138,7 +138,7 @@ func (s *Postgres) AddComment(ctx context.Context, req *pb.AddCommentReq) error
}
}()
res, err := tx.ExecContext(ctx, queryAddComment, req.Text, req.IdPackage.Value)
res, err := tx.ExecContext(ctx, queryAddComment, req.Text, req.IdPackage)
if err != nil {
return err
}
@ -168,7 +168,7 @@ func (s *Postgres) AddPackage(ctx context.Context, req *pb.AddPackageReq) error
}
}()
res, err := tx.ExecContext(ctx, queryAddPackage, req.Name.Value, req.Url.Value, pq.Array(req.Modules))
res, err := tx.ExecContext(ctx, queryAddPackage, req.Name, req.Url, pq.Array(req.Modules))
if err != nil {
return err
}

View File

@ -12,7 +12,7 @@ select
from package;
`
queryAddComment = `
insert into comment(text) values ($1) ;
insert into comment(text) values ($1) returning id;
update package
set comments = json_insert(comments, '$[#]', ( select last_insert_rowid() as id from comment ))
where id = $2 ;

View File

@ -123,10 +123,10 @@ func (s *Sqlite) ListPackage(ctx context.Context) (models.ListPackage, error) {
return result, err
}
func (s *Sqlite) AddComment(ctx context.Context, req *pb.AddCommentReq) error {
func (s *Sqlite) AddComment(ctx context.Context, req *pb.AddCommentReq) (id uint64, err error) {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return err
return 0, err
}
defer func() {
@ -139,18 +139,11 @@ func (s *Sqlite) AddComment(ctx context.Context, req *pb.AddCommentReq) error {
}
}()
res, err := tx.ExecContext(ctx, queryAddComment, req.Text, req.IdPackage.Value)
if err != nil {
return err
if err = tx.QueryRowContext(ctx, queryAddComment, req.Text, req.IdPackage).Scan(&id); err != nil {
return id, err
}
if aff, affErr := res.RowsAffected(); err != nil {
err = affErr
} else if aff == 0 {
err = errors.New("rows affected is 0")
}
return err
return id, err
}
func (s *Sqlite) AddPackage(ctx context.Context, req *pb.AddPackageReq) error {
@ -169,7 +162,7 @@ func (s *Sqlite) AddPackage(ctx context.Context, req *pb.AddPackageReq) error {
}
}()
res, err := tx.ExecContext(ctx, queryAddPackage, req.Name.Value, req.Url.Value, pq.Array(req.Modules))
res, err := tx.ExecContext(ctx, queryAddPackage, req.Name, req.Url, pq.Array(req.Modules))
if err != nil {
return err
}

View File

@ -27,7 +27,7 @@ type Storage interface {
ListPackage(ctx context.Context) (models.ListPackage, error)
UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error
AddComment(ctx context.Context, req *pb.AddCommentReq) error
AddComment(ctx context.Context, req *pb.AddCommentReq) (uint64, error)
AddPackage(ctx context.Context, req *pb.AddPackageReq) error
InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error)
GetModule(ctx context.Context, req *pb.GetModuleReq) (models.ListModule, error)