diff --git a/cmd/pkgdash/main.go b/cmd/pkgdash/main.go new file mode 100644 index 0000000..0d33c43 --- /dev/null +++ b/cmd/pkgdash/main.go @@ -0,0 +1,35 @@ +package main + +import ( + "context" + "os" + "os/signal" + "syscall" + + "go.unistack.org/micro/v4/logger" + "go.unistack.org/unistack-org/pkgdash/service" +) + +func main() { + 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 { + logger.Fatalf(ctx, "failed to create service: %v", err) + } + + // start server + if err = svc.Run(); err != nil { + logger.Fatal(ctx, err) + } +} diff --git a/cmd/rest/server.go b/cmd/rest/server.go deleted file mode 100644 index 648050b..0000000 --- a/cmd/rest/server.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "context" - - "go.unistack.org/micro/v3/logger" - "go.unistack.org/unistack-org/pkgdash/service" -) - -func main() { - ctx := context.Background() - - svc, err := service.NewService(ctx) - if err != nil { - logger.Fatalf(ctx, "failed to create service: %v", err) - } - - // start server - if err = svc.Run(); err != nil { - logger.Fatal(ctx, err) - } - -} diff --git a/cmd/script/main.go b/cmd/script/main.go index 779e647..e5f4aa5 100644 --- a/cmd/script/main.go +++ b/cmd/script/main.go @@ -15,9 +15,9 @@ import ( "github.com/go-git/go-git/v5/plumbing/filemode" "github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/storage/memory" - flagconfig "go.unistack.org/micro-config-flag/v3" - "go.unistack.org/micro/v3/config" - "go.unistack.org/micro/v3/logger" + flagconfig "go.unistack.org/micro-config-flag/v4" + "go.unistack.org/micro/v4/config" + "go.unistack.org/micro/v4/logger" "golang.org/x/mod/modfile" "golang.org/x/mod/module" ) diff --git a/config/config.go b/config/config.go index a5059fb..7e66cb1 100644 --- a/config/config.go +++ b/config/config.go @@ -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, }, diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..e490b50 --- /dev/null +++ b/generate.go @@ -0,0 +1,12 @@ +//go:build tools +// +build tools + +package main + +//go:generate ./generate.sh + +import ( + _ "github.com/envoyproxy/protoc-gen-validate" + _ "go.unistack.org/micro-proto/v4" + _ "go.unistack.org/protoc-gen-go-micro/v4" +) diff --git a/generate.sh b/generate.sh new file mode 100755 index 0000000..ec4e77e --- /dev/null +++ b/generate.sh @@ -0,0 +1,12 @@ +#!/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/v4) \ +--go_out=paths=source_relative:./proto \ +--go-micro_out=paths=source_relative,components=micro|http,standalone=false:./proto \ +--validate_out=paths=source_relative,lang=go:./proto +" + +find ./proto -type f -name "*.pb.go" -delete +protoc -I./proto $PROTO_ARGS ./proto/*.proto || find ./proto -type f -name "*.pb.go" -delete \ No newline at end of file diff --git a/go.mod b/go.mod index 5cda315..99e1e29 100644 --- a/go.mod +++ b/go.mod @@ -12,17 +12,22 @@ 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/v3 v3.9.3 - go.unistack.org/micro-config-flag/v3 v3.8.9 - go.unistack.org/micro-proto/v3 v3.3.1 + 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/v3 v3.10.24 + 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 golang.org/x/mod v0.12.0 - golang.org/x/net v0.12.0 golang.org/x/sync v0.3.0 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 @@ -31,23 +36,25 @@ require ( github.com/cloudflare/circl v1.3.3 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect + github.com/fatih/structtag v1.2.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // 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/protobuf v1.5.3 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/google/gnostic v0.6.9 // indirect + 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.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/pgconn v1.9.1-0.20210724152538-d89c8390a530 // indirect + github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.3.2 // indirect + github.com/jackc/pgproto3/v2 v2.1.1 // 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.4.3 // indirect + github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c // indirect + github.com/jackc/pgx/v5 v5.3.1 // 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/kevinburke/ssh_config v1.2.0 // indirect @@ -56,27 +63,31 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/sergi/go-diff v1.3.1 // indirect + github.com/sergi/go-diff v1.1.0 // indirect github.com/sijms/go-ora/v2 v2.6.7 // 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 - go.uber.org/atomic v1.10.0 // indirect - go.unistack.org/cms-api-proto v0.0.5 // indirect + go.uber.org/atomic v1.6.0 // indirect + go.unistack.org/cms-api-proto v0.0.4 // 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-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 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 golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.11.0 // indirect golang.org/x/tools v0.11.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect - google.golang.org/grpc v1.57.0 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/grpc v1.54.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.3.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect modernc.org/ccgo/v3 v3.16.13 // indirect diff --git a/go.sum b/go.sum index 5931b1c..7e10774 100644 --- a/go.sum +++ b/go.sum @@ -350,6 +350,8 @@ github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBF github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= @@ -491,6 +493,7 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -556,14 +559,12 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -594,12 +595,10 @@ github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530 h1:dUJ578zuPEsXjtzOfEF0q9zDAfljJ9oFnTHcQaNkccw= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.14.0 h1:vrbA9Ud87g6JdFWkHTJXppVce58qPIdP7N8y0Ml/A7Q= -github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= +github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451 h1:WAvSpGf7MsFuzAtK4Vk7R4EVe+liW4x83r4oWu0WHKw= github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds= -github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa h1:s+4MhCQ6YrzisK6hFJUX53drDT4UsSW3DEhKn0ifuHw= -github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= @@ -616,9 +615,8 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1: github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.7/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI= github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.3.2 h1:7eY55bdBeCz1F2fTzSz69QC+pG46jYq9/jtSPiJ5nn0= -github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= @@ -640,17 +638,15 @@ github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXg github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c h1:Dznn52SgVIVst9UyOT9brctYUgxs+CvVfPaC3jKrA50= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.18.1 h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0= -github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE= -github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= -github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= +github.com/jackc/pgx/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU= +github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= @@ -892,8 +888,8 @@ github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfF github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= -github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= @@ -940,8 +936,6 @@ github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -949,10 +943,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1014,9 +1005,8 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -1024,8 +1014,8 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.unistack.org/cms-api-proto v0.0.5 h1:c5tTAP8RvJAkjkeYFmPhcx9k/NEE5Dfo0GDhwL5c530= -go.unistack.org/cms-api-proto v0.0.5/go.mod h1:t5+6CxtaK1CxOv8fG/UJvj911K8+e9d86AHymNR6wDA= +go.unistack.org/cms-api-proto v0.0.4 h1:YFlnlr/rB0IadPiPhBC2B6/U9e4NLgkNvXTsgbu4bcw= +go.unistack.org/cms-api-proto v0.0.4/go.mod h1:t5+6CxtaK1CxOv8fG/UJvj911K8+e9d86AHymNR6wDA= go.unistack.org/cms-service v0.0.1 h1:XKKZqjQD3ViPGRzjadnVX94wQlKcWxompZac9YTeTjw= 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= @@ -1040,15 +1030,25 @@ 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= go.unistack.org/micro-proto/v3 v3.3.1/go.mod h1:cwRyv8uInM2I7EbU7O8Fx2Ls3N90Uw9UCCcq4olOdfE= +go.unistack.org/micro-proto/v4 v4.0.1 h1:2RKHgtCOOcAFgKsnngGK5bqM/6MWXOjVCdw03dbuoF8= +go.unistack.org/micro-proto/v4 v4.0.1/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec= go.unistack.org/micro-server-http/v3 v3.11.6 h1:BSjPyXrJ6OTyuCDE14XOGjLDJEICz2CEo2WfmSR3hqM= go.unistack.org/micro-server-http/v3 v3.11.6/go.mod h1:phNG9aosjbneXvZxEVaVQI+NHLLZ3eA82mOH6gGSShY= +go.unistack.org/micro-server-http/v4 v4.0.9 h1:ye7LVVJSXlvE1TBvEuk4m3iZrAJk0rzs6vD2/qO/o2w= +go.unistack.org/micro-server-http/v4 v4.0.9/go.mod h1:Cu4utVz2u98fychmjA2Ls6clXrja0sqH6Xu/JTamf7Y= go.unistack.org/micro/v3 v3.10.14/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q= -go.unistack.org/micro/v3 v3.10.24 h1:gIi4r0vUSpNLs+uRb4KKEXBLkE8iNp6ZnJsI5FV42j0= -go.unistack.org/micro/v3 v3.10.24/go.mod h1:aywPekJP0n07xvmDgj+Si3VPmQzGMfj6tkHk/6kjXhU= +go.unistack.org/micro/v3 v3.10.18 h1:iz193N8eZKGrKPXuX6XMsGIRHMqdvUaZSfb9mzwlUYM= +go.unistack.org/micro/v3 v3.10.18/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q= +go.unistack.org/micro/v4 v4.0.6 h1:YFWvTh3VwyOd6NHYTQcf47n2TF5+p/EhpnbuBQX3qhk= +go.unistack.org/micro/v4 v4.0.6/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk= +go.unistack.org/protoc-gen-go-micro/v4 v4.0.5 h1:1QTAN51nkQ3uAX0yxH1Ypti1ErghGN1goPA0D6Vnq9c= +go.unistack.org/protoc-gen-go-micro/v4 v4.0.5/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1076,7 +1076,6 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= @@ -1534,8 +1533,8 @@ google.golang.org/genproto v0.0.0-20210721163202-f1cecdd8b78a/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1565,8 +1564,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/handler/encoders/json.go b/handler/encoders/json.go deleted file mode 100644 index e35857e..0000000 --- a/handler/encoders/json.go +++ /dev/null @@ -1,25 +0,0 @@ -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})) -} diff --git a/handler/encoders/jsonpb.go b/handler/encoders/jsonpb.go deleted file mode 100644 index c891ac0..0000000 --- a/handler/encoders/jsonpb.go +++ /dev/null @@ -1,51 +0,0 @@ -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 -} diff --git a/handler/errors.go b/handler/errors.go index f9c6581..5a43729 100644 --- a/handler/errors.go +++ b/handler/errors.go @@ -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(), + }, + } } diff --git a/handler/handlers.go b/handler/handlers.go index ffa934b..9d68daf 100644 --- a/handler/handlers.go +++ b/handler/handlers.go @@ -2,19 +2,18 @@ package handler import ( "context" - "encoding/json" + "database/sql" + "errors" cmsstorage "go.unistack.org/cms-service/storage" - "go.unistack.org/micro/v3" - "go.unistack.org/micro/v3/errors" + httpsrv "go.unistack.org/micro-server-http/v4" + "go.unistack.org/micro/v4" "go.unistack.org/unistack-org/pkgdash/config" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" + 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" - "io" + "google.golang.org/protobuf/types/known/emptypb" "net/http" - "net/url" ) type Handler struct { @@ -29,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() { @@ -150,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 { diff --git a/handler/mapping.go b/handler/mapping.go index 2672469..f24f2d0 100644 --- a/handler/mapping.go +++ b/handler/mapping.go @@ -1,11 +1,11 @@ package handler import ( + "context" "errors" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" "net/http" - "golang.org/x/net/context" + pb "go.unistack.org/unistack-org/pkgdash/proto" ) const ( diff --git a/handler/writer.go b/handler/writer.go index 3caed23..b04eb96 100644 --- a/handler/writer.go +++ b/handler/writer.go @@ -2,11 +2,11 @@ package handler import ( "context" - "go.unistack.org/micro/v3/logger" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" "net/http" "github.com/pkg/errors" + "go.unistack.org/micro/v4/logger" + pb "go.unistack.org/unistack-org/pkgdash/proto" ) type encoder interface { diff --git a/models/mapping.go b/models/mapping.go index 95b1437..c03226b 100644 --- a/models/mapping.go +++ b/models/mapping.go @@ -1,7 +1,7 @@ package models import ( - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" + pb "go.unistack.org/unistack-org/pkgdash/proto" ) type ListPackage []*Package diff --git a/proto/dashboard.proto b/proto/dashboard.proto deleted file mode 100644 index 55072d2..0000000 --- a/proto/dashboard.proto +++ /dev/null @@ -1,99 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = "go.unistack.org/unistack-org/pkgdash/proto/go_generate;go_generate"; - -import "validate/validate.proto"; -import "google/protobuf/wrappers.proto"; - -service DashboardService { - rpc ListPackage(ListPackageReq) returns (ListPackageRsp) {}; - rpc UpdatePackage(UpdatePackageReq) returns (UpdatePackageRsp) {}; - rpc AddComment(AddCommentReq) returns (AddCommentRsp) {}; - rpc AddPackage(AddPackageReq) returns (AddPackageRsp) {}; - rpc GetModule(GetModuleReq) returns (GetModuleRsp) {}; -}; - -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 uint64 modules = 4; - repeated uint64 issues = 5; - repeated uint64 comments = 6; -}; - -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]; - string last_version = 5 [(validate.rules).string.min_len = 1]; -} - -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 UpdatePackageReq { - google.protobuf.UInt64Value id = 1 [(validate.rules).message.required = true]; - google.protobuf.StringValue name = 2 [(validate.rules).message.required = true]; - google.protobuf.StringValue url = 3 [(validate.rules).message.required = true]; - repeated uint64 modules = 4 ; - repeated uint64 issues = 5 ; -} -message UpdatePackageRsp { - uint64 id = 1 [(validate.rules).uint64.gt = 0]; -} - -message AddCommentReq { - google.protobuf.UInt64Value idPackage = 1 [(validate.rules).message.required = true]; - string text = 2; -} - -message AddCommentRsp { - uint64 id = 1 [(validate.rules).uint64.gt = 0]; -} - -message AddPackageReq { - google.protobuf.StringValue name = 1 [(validate.rules).message.required = true]; - google.protobuf.StringValue url = 2 [(validate.rules).message.required = true]; - repeated uint64 modules = 3; -} -message AddPackageRsp{} - -message GetModuleReq { - repeated uint64 id = 1 ; -} -message GetModuleRsp { - repeated Module modules = 1 ; -} \ No newline at end of file diff --git a/proto/docker_generate/Dockerfile b/proto/docker_generate/Dockerfile deleted file mode 100644 index 24e0cd6..0000000 --- a/proto/docker_generate/Dockerfile +++ /dev/null @@ -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 diff --git a/proto/docker_generate/Makefile b/proto/docker_generate/Makefile deleted file mode 100644 index cac80f5..0000000 --- a/proto/docker_generate/Makefile +++ /dev/null @@ -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 \ No newline at end of file diff --git a/proto/docker_generate/dashboard.proto b/proto/docker_generate/dashboard.proto deleted file mode 100644 index e6a9588..0000000 --- a/proto/docker_generate/dashboard.proto +++ /dev/null @@ -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]; -} \ No newline at end of file diff --git a/proto/docker_generate/restService.proto b/proto/docker_generate/restService.proto deleted file mode 100644 index d3205fa..0000000 --- a/proto/docker_generate/restService.proto +++ /dev/null @@ -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) {}; -}; \ No newline at end of file diff --git a/proto/generate.go b/proto/generate.go deleted file mode 100644 index a5986e3..0000000 --- a/proto/generate.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build tools -// +build tools - -package proto - -import ( - _ "github.com/envoyproxy/protoc-gen-validate" - _ "go.unistack.org/micro-proto/v3" -) diff --git a/proto/generate.sh b/proto/generate.sh deleted file mode 100755 index d841b96..0000000 --- a/proto/generate.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/proto/go_generate/dashboard.pb.go b/proto/go_generate/dashboard.pb.go deleted file mode 100644 index 9c9c65d..0000000 --- a/proto/go_generate/dashboard.pb.go +++ /dev/null @@ -1,1388 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc v4.23.4 -// source: dashboard.proto - -package go_generate - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = 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 { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - 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"` - Comments []uint64 `protobuf:"varint,6,rep,packed,name=comments,proto3" json:"comments,omitempty"` -} - -func (x *Package) Reset() { - *x = Package{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Package) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Package) ProtoMessage() {} - -func (x *Package) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[2] - 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 Package.ProtoReflect.Descriptor instead. -func (*Package) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{2} -} - -func (x *Package) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Package) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Package) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Package) GetModules() []uint64 { - if x != nil { - return x.Modules - } - return nil -} - -func (x *Package) GetIssues() []uint64 { - if x != nil { - return x.Issues - } - return nil -} - -func (x *Package) GetComments() []uint64 { - if x != nil { - return x.Comments - } - return nil -} - -type Module struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` - LastVersion string `protobuf:"bytes,5,opt,name=last_version,json=lastVersion,proto3" json:"last_version,omitempty"` -} - -func (x *Module) Reset() { - *x = Module{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Module) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Module) ProtoMessage() {} - -func (x *Module) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[3] - 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 Module.ProtoReflect.Descriptor instead. -func (*Module) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{3} -} - -func (x *Module) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Module) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Module) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Module) GetPackage() uint64 { - if x != nil { - return x.Package - } - return 0 -} - -func (x *Module) GetLastVersion() string { - if x != nil { - return x.LastVersion - } - return "" -} - -type Issue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Status uint64 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` - Desc string `protobuf:"bytes,3,opt,name=desc,proto3" json:"desc,omitempty"` - Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` - Modules []uint64 `protobuf:"varint,5,rep,packed,name=modules,proto3" json:"modules,omitempty"` -} - -func (x *Issue) Reset() { - *x = Issue{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Issue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Issue) ProtoMessage() {} - -func (x *Issue) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[4] - 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 Issue.ProtoReflect.Descriptor instead. -func (*Issue) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{4} -} - -func (x *Issue) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Issue) GetStatus() uint64 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *Issue) GetDesc() string { - if x != nil { - return x.Desc - } - return "" -} - -func (x *Issue) GetPackage() uint64 { - if x != nil { - return x.Package - } - return 0 -} - -func (x *Issue) GetModules() []uint64 { - if x != nil { - return x.Modules - } - return nil -} - -type Comment struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Package uint64 `protobuf:"varint,2,opt,name=package,proto3" json:"package,omitempty"` - Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` - Created uint64 `protobuf:"varint,4,opt,name=created,proto3" json:"created,omitempty"` - Updated uint64 `protobuf:"varint,5,opt,name=updated,proto3" json:"updated,omitempty"` -} - -func (x *Comment) Reset() { - *x = Comment{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Comment) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Comment) ProtoMessage() {} - -func (x *Comment) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[5] - 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 Comment.ProtoReflect.Descriptor instead. -func (*Comment) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{5} -} - -func (x *Comment) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Comment) GetPackage() uint64 { - if x != nil { - return x.Package - } - return 0 -} - -func (x *Comment) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *Comment) GetCreated() uint64 { - if x != nil { - return x.Created - } - return 0 -} - -func (x *Comment) GetUpdated() uint64 { - if x != nil { - return x.Updated - } - return 0 -} - -type ListPackageReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ListPackageReq) Reset() { - *x = ListPackageReq{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListPackageReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListPackageReq) ProtoMessage() {} - -func (x *ListPackageReq) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[6] - 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 ListPackageReq.ProtoReflect.Descriptor instead. -func (*ListPackageReq) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{6} -} - -type ListPackageRsp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Packages []*Package `protobuf:"bytes,1,rep,name=packages,proto3" json:"packages,omitempty"` -} - -func (x *ListPackageRsp) Reset() { - *x = ListPackageRsp{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListPackageRsp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListPackageRsp) ProtoMessage() {} - -func (x *ListPackageRsp) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[7] - 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 ListPackageRsp.ProtoReflect.Descriptor instead. -func (*ListPackageRsp) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{7} -} - -func (x *ListPackageRsp) GetPackages() []*Package { - if x != nil { - return x.Packages - } - return nil -} - -type UpdatePackageReq struct { - state protoimpl.MessageState - 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"` -} - -func (x *UpdatePackageReq) Reset() { - *x = UpdatePackageReq{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdatePackageReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdatePackageReq) ProtoMessage() {} - -func (x *UpdatePackageReq) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdatePackageReq.ProtoReflect.Descriptor instead. -func (*UpdatePackageReq) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{8} -} - -func (x *UpdatePackageReq) GetId() *wrapperspb.UInt64Value { - if x != nil { - return x.Id - } - return nil -} - -func (x *UpdatePackageReq) GetName() *wrapperspb.StringValue { - if x != nil { - return x.Name - } - return nil -} - -func (x *UpdatePackageReq) GetUrl() *wrapperspb.StringValue { - if x != nil { - return x.Url - } - return nil -} - -func (x *UpdatePackageReq) GetModules() []uint64 { - if x != nil { - return x.Modules - } - return nil -} - -func (x *UpdatePackageReq) GetIssues() []uint64 { - if x != nil { - return x.Issues - } - return nil -} - -type UpdatePackageRsp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *UpdatePackageRsp) Reset() { - *x = UpdatePackageRsp{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdatePackageRsp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdatePackageRsp) ProtoMessage() {} - -func (x *UpdatePackageRsp) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdatePackageRsp.ProtoReflect.Descriptor instead. -func (*UpdatePackageRsp) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{9} -} - -func (x *UpdatePackageRsp) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -type AddCommentReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IdPackage *wrapperspb.UInt64Value `protobuf:"bytes,1,opt,name=idPackage,proto3" json:"idPackage,omitempty"` - Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` -} - -func (x *AddCommentReq) Reset() { - *x = AddCommentReq{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddCommentReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddCommentReq) ProtoMessage() {} - -func (x *AddCommentReq) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[10] - 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 AddCommentReq.ProtoReflect.Descriptor instead. -func (*AddCommentReq) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{10} -} - -func (x *AddCommentReq) GetIdPackage() *wrapperspb.UInt64Value { - if x != nil { - return x.IdPackage - } - return nil -} - -func (x *AddCommentReq) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -type AddCommentRsp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *AddCommentRsp) Reset() { - *x = AddCommentRsp{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddCommentRsp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddCommentRsp) ProtoMessage() {} - -func (x *AddCommentRsp) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddCommentRsp.ProtoReflect.Descriptor instead. -func (*AddCommentRsp) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{11} -} - -func (x *AddCommentRsp) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -type AddPackageReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name *wrapperspb.StringValue `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Url *wrapperspb.StringValue `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - Modules []uint64 `protobuf:"varint,3,rep,packed,name=modules,proto3" json:"modules,omitempty"` -} - -func (x *AddPackageReq) Reset() { - *x = AddPackageReq{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddPackageReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddPackageReq) ProtoMessage() {} - -func (x *AddPackageReq) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[12] - 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 AddPackageReq.ProtoReflect.Descriptor instead. -func (*AddPackageReq) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{12} -} - -func (x *AddPackageReq) GetName() *wrapperspb.StringValue { - if x != nil { - return x.Name - } - return nil -} - -func (x *AddPackageReq) GetUrl() *wrapperspb.StringValue { - if x != nil { - return x.Url - } - return nil -} - -func (x *AddPackageReq) GetModules() []uint64 { - if x != nil { - return x.Modules - } - return nil -} - -type AddPackageRsp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AddPackageRsp) Reset() { - *x = AddPackageRsp{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddPackageRsp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddPackageRsp) ProtoMessage() {} - -func (x *AddPackageRsp) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddPackageRsp.ProtoReflect.Descriptor instead. -func (*AddPackageRsp) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{13} -} - -type GetModuleReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id []uint64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` -} - -func (x *GetModuleReq) Reset() { - *x = GetModuleReq{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetModuleReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetModuleReq) ProtoMessage() {} - -func (x *GetModuleReq) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetModuleReq.ProtoReflect.Descriptor instead. -func (*GetModuleReq) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{14} -} - -func (x *GetModuleReq) GetId() []uint64 { - if x != nil { - return x.Id - } - return nil -} - -type GetModuleRsp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Modules []*Module `protobuf:"bytes,1,rep,name=modules,proto3" json:"modules,omitempty"` -} - -func (x *GetModuleRsp) Reset() { - *x = GetModuleRsp{} - if protoimpl.UnsafeEnabled { - mi := &file_dashboard_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetModuleRsp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetModuleRsp) ProtoMessage() {} - -func (x *GetModuleRsp) ProtoReflect() protoreflect.Message { - mi := &file_dashboard_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetModuleRsp.ProtoReflect.Descriptor instead. -func (*GetModuleRsp) Descriptor() ([]byte, []int) { - return file_dashboard_proto_rawDescGZIP(), []int{15} -} - -func (x *GetModuleRsp) GetModules() []*Module { - if x != nil { - return x.Modules - } - return nil -} - -var File_dashboard_proto protoreflect.FileDescriptor - -var file_dashboard_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x64, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x2e, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0x12, 0x22, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, - 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, 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, 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, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x69, - 0x73, 0x73, 0x75, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, - 0x69, 0x64, 0x22, 0x69, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 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, 0x37, 0x0a, 0x0c, 0x47, 0x65, - 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x73, 0x32, 0xc7, 0x02, 0x0a, 0x10, 0x44, 0x61, 0x73, 0x68, 0x62, 0x6f, 0x61, 0x72, - 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a, - 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, - 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x73, 0x70, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, - 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, - 0x73, 0x70, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, - 0x65, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, - 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x22, 0x00, 0x42, 0x44, 0x5a, - 0x42, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x6f, 0x72, 0x67, - 0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x6b, - 0x67, 0x64, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x3b, 0x67, 0x6f, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_dashboard_proto_rawDescOnce sync.Once - file_dashboard_proto_rawDescData = file_dashboard_proto_rawDesc -) - -func file_dashboard_proto_rawDescGZIP() []byte { - file_dashboard_proto_rawDescOnce.Do(func() { - file_dashboard_proto_rawDescData = protoimpl.X.CompressGZIP(file_dashboard_proto_rawDescData) - }) - return file_dashboard_proto_rawDescData -} - -var file_dashboard_proto_msgTypes = make([]protoimpl.MessageInfo, 16) -var file_dashboard_proto_goTypes = []interface{}{ - (*ErrorRsp)(nil), // 0: proto.ErrorRsp - (*Error)(nil), // 1: proto.Error - (*Package)(nil), // 2: proto.Package - (*Module)(nil), // 3: proto.Module - (*Issue)(nil), // 4: proto.Issue - (*Comment)(nil), // 5: proto.Comment - (*ListPackageReq)(nil), // 6: proto.ListPackageReq - (*ListPackageRsp)(nil), // 7: proto.ListPackageRsp - (*UpdatePackageReq)(nil), // 8: proto.UpdatePackageReq - (*UpdatePackageRsp)(nil), // 9: proto.UpdatePackageRsp - (*AddCommentReq)(nil), // 10: proto.AddCommentReq - (*AddCommentRsp)(nil), // 11: proto.AddCommentRsp - (*AddPackageReq)(nil), // 12: proto.AddPackageReq - (*AddPackageRsp)(nil), // 13: proto.AddPackageRsp - (*GetModuleReq)(nil), // 14: proto.GetModuleReq - (*GetModuleRsp)(nil), // 15: proto.GetModuleRsp - (*wrapperspb.UInt64Value)(nil), // 16: google.protobuf.UInt64Value - (*wrapperspb.StringValue)(nil), // 17: google.protobuf.StringValue -} -var file_dashboard_proto_depIdxs = []int32{ - 1, // 0: proto.ErrorRsp.error:type_name -> proto.Error - 2, // 1: proto.ListPackageRsp.packages:type_name -> proto.Package - 16, // 2: proto.UpdatePackageReq.id:type_name -> google.protobuf.UInt64Value - 17, // 3: proto.UpdatePackageReq.name:type_name -> google.protobuf.StringValue - 17, // 4: proto.UpdatePackageReq.url:type_name -> google.protobuf.StringValue - 16, // 5: proto.AddCommentReq.idPackage:type_name -> google.protobuf.UInt64Value - 17, // 6: proto.AddPackageReq.name:type_name -> google.protobuf.StringValue - 17, // 7: proto.AddPackageReq.url:type_name -> google.protobuf.StringValue - 3, // 8: proto.GetModuleRsp.modules:type_name -> proto.Module - 6, // 9: proto.DashboardService.ListPackage:input_type -> proto.ListPackageReq - 8, // 10: proto.DashboardService.UpdatePackage:input_type -> proto.UpdatePackageReq - 10, // 11: proto.DashboardService.AddComment:input_type -> proto.AddCommentReq - 12, // 12: proto.DashboardService.AddPackage:input_type -> proto.AddPackageReq - 14, // 13: proto.DashboardService.GetModule:input_type -> proto.GetModuleReq - 7, // 14: proto.DashboardService.ListPackage:output_type -> proto.ListPackageRsp - 9, // 15: proto.DashboardService.UpdatePackage:output_type -> proto.UpdatePackageRsp - 11, // 16: proto.DashboardService.AddComment:output_type -> proto.AddCommentRsp - 13, // 17: proto.DashboardService.AddPackage:output_type -> proto.AddPackageRsp - 15, // 18: proto.DashboardService.GetModule:output_type -> proto.GetModuleRsp - 14, // [14:19] is the sub-list for method output_type - 9, // [9:14] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_dashboard_proto_init() } -func file_dashboard_proto_init() { - if File_dashboard_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_dashboard_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ErrorRsp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Error); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Package); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Module); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Issue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Comment); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPackageReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPackageRsp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdatePackageReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdatePackageRsp); 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.(*AddCommentReq); 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.(*AddCommentRsp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddPackageReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddPackageRsp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetModuleReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dashboard_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetModuleRsp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_dashboard_proto_rawDesc, - NumEnums: 0, - NumMessages: 16, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_dashboard_proto_goTypes, - DependencyIndexes: file_dashboard_proto_depIdxs, - MessageInfos: file_dashboard_proto_msgTypes, - }.Build() - File_dashboard_proto = out.File - file_dashboard_proto_rawDesc = nil - file_dashboard_proto_goTypes = nil - file_dashboard_proto_depIdxs = nil -} diff --git a/proto/micro/dashboard_micro.pb.go b/proto/micro/dashboard_micro.pb.go deleted file mode 100644 index 2d09b9d..0000000 --- a/proto/micro/dashboard_micro.pb.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by protoc-gen-go-micro. DO NOT EDIT. -// versions: -// - protoc-gen-go-micro v3.10.3 -// - protoc v4.23.4 -// source: dashboard.proto - -package go_generate - -import ( - context "context" - v3 "go.unistack.org/micro-server-http/v3" - client "go.unistack.org/micro/v3/client" - go_generate "go.unistack.org/unistack-org/pkgdash/proto/go_generate" -) - -var ( - DashboardServiceName = "DashboardService" -) -var ( - DashboardServiceServerEndpoints = []v3.EndpointMetadata{} -) - -type DashboardServiceClient interface { - ListPackage(ctx context.Context, req *go_generate.ListPackageReq, opts ...client.CallOption) (*go_generate.ListPackageRsp, error) - UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, opts ...client.CallOption) (*go_generate.UpdatePackageRsp, error) - AddComment(ctx context.Context, req *go_generate.AddCommentReq, opts ...client.CallOption) (*go_generate.AddCommentRsp, error) - AddPackage(ctx context.Context, req *go_generate.AddPackageReq, opts ...client.CallOption) (*go_generate.AddPackageRsp, error) - GetModule(ctx context.Context, req *go_generate.GetModuleReq, opts ...client.CallOption) (*go_generate.GetModuleRsp, error) -} - -type DashboardServiceServer interface { - ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error - UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, rsp *go_generate.UpdatePackageRsp) error - AddComment(ctx context.Context, req *go_generate.AddCommentReq, rsp *go_generate.AddCommentRsp) error - AddPackage(ctx context.Context, req *go_generate.AddPackageReq, rsp *go_generate.AddPackageRsp) error - GetModule(ctx context.Context, req *go_generate.GetModuleReq, rsp *go_generate.GetModuleRsp) error -} diff --git a/proto/micro/dashboard_micro_http.pb.go b/proto/micro/dashboard_micro_http.pb.go deleted file mode 100644 index 769cc56..0000000 --- a/proto/micro/dashboard_micro_http.pb.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by protoc-gen-go-micro. DO NOT EDIT. -// protoc-gen-go-micro version: v3.10.3 -// source: dashboard.proto - -package go_generate - -import ( - context "context" - _ "go.unistack.org/micro-client-http/v3" - v3 "go.unistack.org/micro-server-http/v3" - client "go.unistack.org/micro/v3/client" - server "go.unistack.org/micro/v3/server" - go_generate "go.unistack.org/unistack-org/pkgdash/proto/go_generate" -) - -type dashboardServiceClient struct { - c client.Client - name string -} - -func NewDashboardServiceClient(name string, c client.Client) DashboardServiceClient { - return &dashboardServiceClient{c: c, name: name} -} - -func (c *dashboardServiceClient) ListPackage(ctx context.Context, req *go_generate.ListPackageReq, opts ...client.CallOption) (*go_generate.ListPackageRsp, error) { - rsp := &go_generate.ListPackageRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.ListPackage", req), rsp, opts...) - if err != nil { - return nil, err - } - return rsp, nil -} - -func (c *dashboardServiceClient) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, opts ...client.CallOption) (*go_generate.UpdatePackageRsp, error) { - rsp := &go_generate.UpdatePackageRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.UpdatePackage", req), rsp, opts...) - if err != nil { - return nil, err - } - return rsp, nil -} - -func (c *dashboardServiceClient) AddComment(ctx context.Context, req *go_generate.AddCommentReq, opts ...client.CallOption) (*go_generate.AddCommentRsp, error) { - rsp := &go_generate.AddCommentRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.AddComment", req), rsp, opts...) - if err != nil { - return nil, err - } - return rsp, nil -} - -func (c *dashboardServiceClient) AddPackage(ctx context.Context, req *go_generate.AddPackageReq, opts ...client.CallOption) (*go_generate.AddPackageRsp, error) { - rsp := &go_generate.AddPackageRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.AddPackage", req), rsp, opts...) - if err != nil { - return nil, err - } - return rsp, nil -} - -func (c *dashboardServiceClient) GetModule(ctx context.Context, req *go_generate.GetModuleReq, opts ...client.CallOption) (*go_generate.GetModuleRsp, error) { - rsp := &go_generate.GetModuleRsp{} - err := c.c.Call(ctx, c.c.NewRequest(c.name, "DashboardService.GetModule", req), rsp, opts...) - if err != nil { - return nil, err - } - return rsp, nil -} - -type dashboardServiceServer struct { - DashboardServiceServer -} - -func (h *dashboardServiceServer) ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error { - return h.DashboardServiceServer.ListPackage(ctx, req, rsp) -} - -func (h *dashboardServiceServer) UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, rsp *go_generate.UpdatePackageRsp) error { - return h.DashboardServiceServer.UpdatePackage(ctx, req, rsp) -} - -func (h *dashboardServiceServer) AddComment(ctx context.Context, req *go_generate.AddCommentReq, rsp *go_generate.AddCommentRsp) error { - return h.DashboardServiceServer.AddComment(ctx, req, rsp) -} - -func (h *dashboardServiceServer) AddPackage(ctx context.Context, req *go_generate.AddPackageReq, rsp *go_generate.AddPackageRsp) error { - return h.DashboardServiceServer.AddPackage(ctx, req, rsp) -} - -func (h *dashboardServiceServer) GetModule(ctx context.Context, req *go_generate.GetModuleReq, rsp *go_generate.GetModuleRsp) error { - return h.DashboardServiceServer.GetModule(ctx, req, rsp) -} - -func RegisterDashboardServiceServer(s server.Server, sh DashboardServiceServer, opts ...server.HandlerOption) error { - type dashboardService interface { - ListPackage(ctx context.Context, req *go_generate.ListPackageReq, rsp *go_generate.ListPackageRsp) error - UpdatePackage(ctx context.Context, req *go_generate.UpdatePackageReq, rsp *go_generate.UpdatePackageRsp) error - AddComment(ctx context.Context, req *go_generate.AddCommentReq, rsp *go_generate.AddCommentRsp) error - AddPackage(ctx context.Context, req *go_generate.AddPackageReq, rsp *go_generate.AddPackageRsp) error - GetModule(ctx context.Context, req *go_generate.GetModuleReq, rsp *go_generate.GetModuleRsp) error - } - type DashboardService struct { - dashboardService - } - h := &dashboardServiceServer{sh} - var nopts []server.HandlerOption - nopts = append(nopts, v3.HandlerEndpoints(DashboardServiceServerEndpoints)) - return s.Handle(s.NewHandler(&DashboardService{h}, append(nopts, opts...)...)) -} diff --git a/proto/pkgdash.pb.go b/proto/pkgdash.pb.go new file mode 100644 index 0000000..2531e73 --- /dev/null +++ b/proto/pkgdash.pb.go @@ -0,0 +1,1479 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.23.4 +// source: pkgdash.proto + +package pkgdashpb + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + _ "go.unistack.org/micro-proto/v4/api" + _ "go.unistack.org/micro-proto/v4/openapiv3" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = 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_pkgdash_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_pkgdash_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_pkgdash_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_pkgdash_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_pkgdash_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_pkgdash_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 { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + Comments []uint64 `protobuf:"varint,6,rep,packed,name=comments,proto3" json:"comments,omitempty"` +} + +func (x *Package) Reset() { + *x = Package{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Package) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Package) ProtoMessage() {} + +func (x *Package) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[2] + 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 Package.ProtoReflect.Descriptor instead. +func (*Package) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{2} +} + +func (x *Package) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Package) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Package) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Package) GetModules() []uint64 { + if x != nil { + return x.Modules + } + return nil +} + +func (x *Package) GetIssues() []uint64 { + if x != nil { + return x.Issues + } + return nil +} + +func (x *Package) GetComments() []uint64 { + if x != nil { + return x.Comments + } + return nil +} + +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` + LastVersion string `protobuf:"bytes,5,opt,name=last_version,json=lastVersion,proto3" json:"last_version,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +func (x *Module) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[3] + 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 Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{3} +} + +func (x *Module) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Module) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Module) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Module) GetPackage() uint64 { + if x != nil { + return x.Package + } + return 0 +} + +func (x *Module) GetLastVersion() string { + if x != nil { + return x.LastVersion + } + return "" +} + +type Issue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Status uint64 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` + Desc string `protobuf:"bytes,3,opt,name=desc,proto3" json:"desc,omitempty"` + Package uint64 `protobuf:"varint,4,opt,name=package,proto3" json:"package,omitempty"` + Modules []uint64 `protobuf:"varint,5,rep,packed,name=modules,proto3" json:"modules,omitempty"` +} + +func (x *Issue) Reset() { + *x = Issue{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Issue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Issue) ProtoMessage() {} + +func (x *Issue) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[4] + 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 Issue.ProtoReflect.Descriptor instead. +func (*Issue) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{4} +} + +func (x *Issue) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Issue) GetStatus() uint64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *Issue) GetDesc() string { + if x != nil { + return x.Desc + } + return "" +} + +func (x *Issue) GetPackage() uint64 { + if x != nil { + return x.Package + } + return 0 +} + +func (x *Issue) GetModules() []uint64 { + if x != nil { + return x.Modules + } + return nil +} + +type Comment struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Package uint64 `protobuf:"varint,2,opt,name=package,proto3" json:"package,omitempty"` + Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` + Created uint64 `protobuf:"varint,4,opt,name=created,proto3" json:"created,omitempty"` + Updated uint64 `protobuf:"varint,5,opt,name=updated,proto3" json:"updated,omitempty"` +} + +func (x *Comment) Reset() { + *x = Comment{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Comment) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Comment) ProtoMessage() {} + +func (x *Comment) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[5] + 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 Comment.ProtoReflect.Descriptor instead. +func (*Comment) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{5} +} + +func (x *Comment) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Comment) GetPackage() uint64 { + if x != nil { + return x.Package + } + return 0 +} + +func (x *Comment) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Comment) GetCreated() uint64 { + if x != nil { + return x.Created + } + return 0 +} + +func (x *Comment) GetUpdated() uint64 { + if x != nil { + return x.Updated + } + return 0 +} + +type ListPackageReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListPackageReq) Reset() { + *x = ListPackageReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPackageReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPackageReq) ProtoMessage() {} + +func (x *ListPackageReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[6] + 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 ListPackageReq.ProtoReflect.Descriptor instead. +func (*ListPackageReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{6} +} + +type ListPackageRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Packages []*Package `protobuf:"bytes,1,rep,name=packages,proto3" json:"packages,omitempty"` +} + +func (x *ListPackageRsp) Reset() { + *x = ListPackageRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListPackageRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPackageRsp) ProtoMessage() {} + +func (x *ListPackageRsp) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[7] + 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 ListPackageRsp.ProtoReflect.Descriptor instead. +func (*ListPackageRsp) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{7} +} + +func (x *ListPackageRsp) GetPackages() []*Package { + if x != nil { + return x.Packages + } + return nil +} + +type UpdatePackageReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + 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() { + *x = UpdatePackageReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePackageReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePackageReq) ProtoMessage() {} + +func (x *UpdatePackageReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdatePackageReq.ProtoReflect.Descriptor instead. +func (*UpdatePackageReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdatePackageReq) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UpdatePackageReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdatePackageReq) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *UpdatePackageReq) GetModules() []uint64 { + if x != nil { + return x.Modules + } + return nil +} + +func (x *UpdatePackageReq) GetIssues() []uint64 { + if x != nil { + return x.Issues + } + return nil +} + +type UpdatePackageRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *UpdatePackageRsp) Reset() { + *x = UpdatePackageRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePackageRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePackageRsp) ProtoMessage() {} + +func (x *UpdatePackageRsp) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdatePackageRsp.ProtoReflect.Descriptor instead. +func (*UpdatePackageRsp) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{9} +} + +func (x *UpdatePackageRsp) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +type CommentReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pkg uint64 `protobuf:"varint,1,opt,name=pkg,proto3" json:"pkg,omitempty"` + Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` +} + +func (x *CommentReq) Reset() { + *x = CommentReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentReq) ProtoMessage() {} + +func (x *CommentReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[10] + 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 CommentReq.ProtoReflect.Descriptor instead. +func (*CommentReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{10} +} + +func (x *CommentReq) GetPkg() uint64 { + if x != nil { + return x.Pkg + } + return 0 +} + +func (x *CommentReq) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +type AddCommentReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IdPackage uint64 `protobuf:"varint,1,opt,name=idPackage,proto3" json:"idPackage,omitempty"` + Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` +} + +func (x *AddCommentReq) Reset() { + *x = AddCommentReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddCommentReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddCommentReq) ProtoMessage() {} + +func (x *AddCommentReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[11] + 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 AddCommentReq.ProtoReflect.Descriptor instead. +func (*AddCommentReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{11} +} + +func (x *AddCommentReq) GetIdPackage() uint64 { + if x != nil { + return x.IdPackage + } + return 0 +} + +func (x *AddCommentReq) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +type AddCommentRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *AddCommentRsp) Reset() { + *x = AddCommentRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddCommentRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddCommentRsp) ProtoMessage() {} + +func (x *AddCommentRsp) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[12] + 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 AddCommentRsp.ProtoReflect.Descriptor instead. +func (*AddCommentRsp) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{12} +} + +func (x *AddCommentRsp) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +type AddPackageReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + Modules []uint64 `protobuf:"varint,3,rep,packed,name=modules,proto3" json:"modules,omitempty"` +} + +func (x *AddPackageReq) Reset() { + *x = AddPackageReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddPackageReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddPackageReq) ProtoMessage() {} + +func (x *AddPackageReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddPackageReq.ProtoReflect.Descriptor instead. +func (*AddPackageReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{13} +} + +func (x *AddPackageReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AddPackageReq) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *AddPackageReq) GetModules() []uint64 { + if x != nil { + return x.Modules + } + return nil +} + +type AddPackageRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *AddPackageRsp) Reset() { + *x = AddPackageRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddPackageRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddPackageRsp) ProtoMessage() {} + +func (x *AddPackageRsp) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddPackageRsp.ProtoReflect.Descriptor instead. +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 + unknownFields protoimpl.UnknownFields + + Id []uint64 `protobuf:"varint,1,rep,packed,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetModuleReq) Reset() { + *x = GetModuleReq{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModuleReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModuleReq) ProtoMessage() {} + +func (x *GetModuleReq) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModuleReq.ProtoReflect.Descriptor instead. +func (*GetModuleReq) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{15} +} + +func (x *GetModuleReq) GetId() []uint64 { + if x != nil { + return x.Id + } + return nil +} + +type GetModuleRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Modules []*Module `protobuf:"bytes,1,rep,name=modules,proto3" json:"modules,omitempty"` +} + +func (x *GetModuleRsp) Reset() { + *x = GetModuleRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_pkgdash_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetModuleRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetModuleRsp) ProtoMessage() {} + +func (x *GetModuleRsp) ProtoReflect() protoreflect.Message { + mi := &file_pkgdash_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetModuleRsp.ProtoReflect.Descriptor instead. +func (*GetModuleRsp) Descriptor() ([]byte, []int) { + return file_pkgdash_proto_rawDescGZIP(), []int{16} +} + +func (x *GetModuleRsp) GetModules() []*Module { + if x != nil { + return x.Modules + } + return nil +} + +var File_pkgdash_proto protoreflect.FileDescriptor + +var file_pkgdash_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x1a, 0x15, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 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, 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, + 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, + 0x70, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x32, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3b, 0x0a, 0x0a, 0x43, 0x6f, + 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, 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 ( + file_pkgdash_proto_rawDescOnce sync.Once + file_pkgdash_proto_rawDescData = file_pkgdash_proto_rawDesc +) + +func file_pkgdash_proto_rawDescGZIP() []byte { + file_pkgdash_proto_rawDescOnce.Do(func() { + file_pkgdash_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkgdash_proto_rawDescData) + }) + return file_pkgdash_proto_rawDescData +} + +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 + (*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 + 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() } +func file_pkgdash_proto_init() { + if File_pkgdash_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkgdash_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ErrorRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Error); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Package); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Issue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Comment); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPackageReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListPackageRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePackageReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePackageRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddCommentReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddCommentRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddPackageReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddPackageRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModuleReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkgdash_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetModuleRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkgdash_proto_rawDesc, + NumEnums: 0, + NumMessages: 17, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pkgdash_proto_goTypes, + DependencyIndexes: file_pkgdash_proto_depIdxs, + MessageInfos: file_pkgdash_proto_msgTypes, + }.Build() + File_pkgdash_proto = out.File + file_pkgdash_proto_rawDesc = nil + file_pkgdash_proto_goTypes = nil + file_pkgdash_proto_depIdxs = nil +} diff --git a/proto/go_generate/dashboard.pb.validate.go b/proto/pkgdash.pb.validate.go similarity index 90% rename from proto/go_generate/dashboard.pb.validate.go rename to proto/pkgdash.pb.validate.go index 102ee08..6165d02 100644 --- a/proto/go_generate/dashboard.pb.validate.go +++ b/proto/pkgdash.pb.validate.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-validate. DO NOT EDIT. -// source: dashboard.proto +// source: pkgdash.proto -package go_generate +package pkgdashpb import ( "bytes" @@ -1095,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 @@ -1106,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 @@ -1146,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 @@ -1186,35 +1128,6 @@ 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) } @@ -1404,6 +1317,118 @@ var _ interface { ErrorName() string } = UpdatePackageRspValidationError{} +// Validate checks the field values on CommentReq 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 *CommentReq) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CommentReq 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 CommentReqMultiError, or +// nil if none found. +func (m *CommentReq) ValidateAll() error { + return m.validate(true) +} + +func (m *CommentReq) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.GetPkg() <= 0 { + err := CommentReqValidationError{ + field: "Pkg", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Text + + if len(errors) > 0 { + return CommentReqMultiError(errors) + } + + return nil +} + +// CommentReqMultiError is an error wrapping multiple validation errors +// returned by CommentReq.ValidateAll() if the designated constraints aren't met. +type CommentReqMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CommentReqMultiError) 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 CommentReqMultiError) AllErrors() []error { return m } + +// CommentReqValidationError is the validation error returned by +// CommentReq.Validate if the designated constraints aren't met. +type CommentReqValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CommentReqValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CommentReqValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CommentReqValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CommentReqValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CommentReqValidationError) ErrorName() string { return "CommentReqValidationError" } + +// Error satisfies the builtin error interface +func (e CommentReqValidationError) 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 %sCommentReq.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CommentReqValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CommentReqValidationError{} + // Validate checks the field values on AddCommentReq 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. @@ -1426,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 @@ -1437,35 +1462,6 @@ 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 { @@ -1679,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 @@ -1690,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 @@ -1730,35 +1697,6 @@ 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) } @@ -1859,6 +1797,17 @@ 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) } diff --git a/proto/pkgdash.proto b/proto/pkgdash.proto new file mode 100644 index 0000000..6210d82 --- /dev/null +++ b/proto/pkgdash.proto @@ -0,0 +1,172 @@ +syntax = "proto3"; + +package pkgdash; + +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/empty.proto"; + +service PkgdashService { + rpc ListPackage(google.protobuf.Empty) returns (ListPackageRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "ListPackage"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + get: "/v1/packages"; + }; + }; + rpc UpdatePackage(UpdatePackageReq) returns (UpdatePackageRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "UpdateInfo"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + post: "/v1/package/{id}"; + body: "*"; + }; + }; + rpc AddComment(AddCommentReq) returns (AddCommentRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "AddComment"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + post: "/v1/package/{pkg}/comment"; + body: "*"; + }; + }; + rpc AddPackage(AddPackageReq) returns (AddPackageRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "AddPackage"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + post: "/v1/package"; + body: "*"; + }; + }; + rpc GetModule(GetModuleReq) returns (GetModuleRsp) { + option (micro.openapiv3.openapiv3_operation) = { + operation_id: "GetModule"; + responses: { + default: { + reference: {_ref: ".pkgdash.ErrorRsp"}; + }; + }; + }; + option (micro.api.http) = { + get: "/v1/module"; + }; + }; +}; + +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 uint64 modules = 4; + repeated uint64 issues = 5; + repeated uint64 comments = 6; +}; + +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]; + string last_version = 5 [(validate.rules).string.min_len = 1]; +} + +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 UpdatePackageReq { + 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 ; +} +message UpdatePackageRsp { + uint64 id = 1 [(validate.rules).uint64.gt = 0]; +} + +message CommentReq { + uint64 pkg = 1 [(validate.rules).uint64.gt = 0]; + string text = 2; +} + +message AddCommentReq { + uint64 idPackage = 1 [(validate.rules).uint64.gt = 0]; + string text = 2; +} + +message AddCommentRsp { + uint64 id = 1 [(validate.rules).uint64.gt = 0]; +} + +message AddPackageReq { + string name = 1 [(validate.rules).string.min_len = 1]; + string url = 2 [(validate.rules).string.min_len = 1]; + repeated uint64 modules = 3; +} + +message AddPackageRsp{ + string status = 1 [(validate.rules).string.min_len = 1]; +} + +message GetModuleReq { + repeated uint64 id = 1 ; +} +message GetModuleRsp { + repeated Module modules = 1 ; +} \ No newline at end of file diff --git a/proto/pkgdash_micro.pb.go b/proto/pkgdash_micro.pb.go new file mode 100644 index 0000000..2eed3f4 --- /dev/null +++ b/proto/pkgdash_micro.pb.go @@ -0,0 +1,73 @@ +// Code generated by protoc-gen-go-micro. DO NOT EDIT. +// versions: +// - protoc-gen-go-micro v3.10.3 +// - protoc v4.23.4 +// source: pkgdash.proto + +package pkgdashpb + +import ( + context "context" + 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 *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 *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 + GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error +} diff --git a/proto/pkgdash_micro_http.pb.go b/proto/pkgdash_micro_http.pb.go new file mode 100644 index 0000000..43b79b7 --- /dev/null +++ b/proto/pkgdash_micro_http.pb.go @@ -0,0 +1,158 @@ +// Code generated by protoc-gen-go-micro. DO NOT EDIT. +// protoc-gen-go-micro version: v3.10.3 +// source: pkgdash.proto + +package pkgdashpb + +import ( + context "context" + 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" +) + +type pkgdashServiceClient struct { + c client.Client + name string +} + +func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient { + return &pkgdashServiceClient{c: c, name: name} +} + +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, + v3.ErrorMap(errmap), + ) + opts = append(opts, + 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...) + if err != nil { + return nil, err + } + return rsp, nil +} + +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, + v3.ErrorMap(errmap), + ) + opts = append(opts, + 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...) + if err != nil { + return nil, err + } + return rsp, nil +} + +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, + v3.ErrorMap(errmap), + ) + opts = append(opts, + 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...) + if err != nil { + return nil, err + } + return rsp, nil +} + +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, + v3.ErrorMap(errmap), + ) + opts = append(opts, + 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...) + if err != nil { + return nil, err + } + return rsp, nil +} + +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, + v3.ErrorMap(errmap), + ) + opts = append(opts, + 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...) + if err != nil { + return nil, err + } + return rsp, nil +} + +type pkgdashServiceServer struct { + PkgdashServiceServer +} + +func (h *pkgdashServiceServer) ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error { + return h.PkgdashServiceServer.ListPackage(ctx, req, rsp) +} + +func (h *pkgdashServiceServer) UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error { + return h.PkgdashServiceServer.UpdatePackage(ctx, req, rsp) +} + +func (h *pkgdashServiceServer) AddComment(ctx context.Context, req *AddCommentReq, rsp *AddCommentRsp) error { + return h.PkgdashServiceServer.AddComment(ctx, req, rsp) +} + +func (h *pkgdashServiceServer) AddPackage(ctx context.Context, req *AddPackageReq, rsp *AddPackageRsp) error { + return h.PkgdashServiceServer.AddPackage(ctx, req, rsp) +} + +func (h *pkgdashServiceServer) GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error { + return h.PkgdashServiceServer.GetModule(ctx, req, rsp) +} + +func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...server.HandlerOption) error { + type pkgdashService interface { + 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 + GetModule(ctx context.Context, req *GetModuleReq, rsp *GetModuleRsp) error + } + type PkgdashService struct { + pkgdashService + } + h := &pkgdashServiceServer{sh} + var nopts []server.HandlerOption + nopts = append(nopts, v31.HandlerEndpoints(PkgdashServiceServerEndpoints)) + return s.Handle(s.NewHandler(&PkgdashService{h}, append(nopts, opts...)...)) +} diff --git a/service/client_git/client.go b/service/client_git/client.go index de49bdc..870cd0d 100644 --- a/service/client_git/client.go +++ b/service/client_git/client.go @@ -3,9 +3,6 @@ package client_git import ( "context" "fmt" - "github.com/pkg/errors" - "go.unistack.org/unistack-org/pkgdash/internal" - "go.unistack.org/unistack-org/pkgdash/models" "io" "net/url" "os" @@ -16,8 +13,11 @@ import ( "github.com/go-git/go-git/v5/plumbing/filemode" "github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/storage/memory" - "go.unistack.org/micro/v3/logger" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" + "github.com/pkg/errors" + "go.unistack.org/micro/v4/logger" + "go.unistack.org/unistack-org/pkgdash/internal" + "go.unistack.org/unistack-org/pkgdash/models" + pb "go.unistack.org/unistack-org/pkgdash/proto" "go.unistack.org/unistack-org/pkgdash/storage" "golang.org/x/mod/modfile" "golang.org/x/mod/module" diff --git a/service/client_git/client_test.go b/service/client_git/client_test.go index a779ad5..34551e8 100644 --- a/service/client_git/client_test.go +++ b/service/client_git/client_test.go @@ -4,7 +4,7 @@ import ( "context" "database/sql" "fmt" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" + pb "go.unistack.org/unistack-org/pkgdash/proto" "go.unistack.org/unistack-org/pkgdash/storage" "go.unistack.org/unistack-org/pkgdash/storage/postgres" "go.unistack.org/unistack-org/pkgdash/storage/sqlite" diff --git a/service/service.go b/service/service.go index 8b8fb75..820898a 100644 --- a/service/service.go +++ b/service/service.go @@ -2,83 +2,63 @@ package service import ( "context" - cmsstorage "go.unistack.org/cms-service/storage" + 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" - "net/http" - - //pbmicro "go.unistack.org/unistack-org/pkgdash/proto/micro" "go.unistack.org/unistack-org/pkgdash/storage" - - cmsservice "go.unistack.org/cms-service" - "go.unistack.org/micro/v3" - "go.unistack.org/micro/v3/config" - "go.unistack.org/micro/v3/logger" - "go.unistack.org/micro/v3/register" - microuter "go.unistack.org/micro/v3/router" - "go.unistack.org/micro/v3/server" ) func NewService(ctx context.Context) (micro.Service, error) { var reg register.Register - var router microuter.Router - - if ctx == nil { - ctx = context.Background() - } cfg := intcfg.NewConfig() - cs := cmsservice.NewConfigLocal(cfg) - if r, ok := register.FromContext(ctx); ok && r != nil { - reg = r - } else { - reg = register.NewRegister() - } - if r, ok := microuter.FromContext(ctx); ok && r != nil { - router = r - } else { - router = microuter.NewRouter() - } + cs := microcfg.NewConfig(config.Struct(cfg)) - svc := micro.NewService( - micro.Register(reg), - micro.Router(router), - micro.Config(cs...), + // TODO + mgsrv := httpsrv.NewServer( + options.Register(reg), ) - writer, err := handler.NewWriter(encoders.NewJSONProto()) - if err != nil { - logger.Fatalf(ctx, "failed init writer: %v", err) - } + svc := micro.NewService( + micro.Config(cs), + ) - h := handler.NewHandler(svc, writer, client_git.NewClient(5)) + h := handler.NewHandler(svc, 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( - server.Address(cfg.App.Address), - server.Name(cfg.Service.Name), - server.Version(cfg.Service.Version), + if err := svc.Server("http").Init( + options.Address(cfg.Address), + options.Name(cfg.App.Name), + server.Version(cfg.App.Version), ); err != nil { return err } @@ -86,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) @@ -126,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) } diff --git a/storage/postgres/quries.go b/storage/postgres/queries.go similarity index 85% rename from storage/postgres/quries.go rename to storage/postgres/queries.go index aa0e3c8..dd06434 100644 --- a/storage/postgres/quries.go +++ b/storage/postgres/queries.go @@ -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 ; ` ) diff --git a/storage/postgres/storage.go b/storage/postgres/storage.go index ad50e56..61f4b68 100644 --- a/storage/postgres/storage.go +++ b/storage/postgres/storage.go @@ -6,16 +6,16 @@ import ( "embed" "errors" "fmt" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" "strings" "github.com/golang-migrate/migrate/v4" mpgx "github.com/golang-migrate/migrate/v4/database/pgx" "github.com/golang-migrate/migrate/v4/source/iofs" "github.com/lib/pq" - "go.unistack.org/micro/v3/logger" + "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 } diff --git a/storage/sqlite/quries.go b/storage/sqlite/queries.go similarity index 91% rename from storage/sqlite/quries.go rename to storage/sqlite/queries.go index 2b6922b..917e23c 100644 --- a/storage/sqlite/quries.go +++ b/storage/sqlite/queries.go @@ -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 ; diff --git a/storage/sqlite/storage.go b/storage/sqlite/storage.go index 21bb39d..bf464c5 100644 --- a/storage/sqlite/storage.go +++ b/storage/sqlite/storage.go @@ -8,16 +8,15 @@ import ( "fmt" "strings" - _ "github.com/mattn/go-sqlite3" - "github.com/golang-migrate/migrate/v4" "github.com/golang-migrate/migrate/v4/database/sqlite" "github.com/golang-migrate/migrate/v4/source/iofs" "github.com/lib/pq" - "go.unistack.org/micro/v3/logger" + _ "github.com/mattn/go-sqlite3" + "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/go_generate" + pb "go.unistack.org/unistack-org/pkgdash/proto" ) const ( @@ -124,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() { @@ -140,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 { @@ -170,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 } diff --git a/storage/storage.go b/storage/storage.go index 188562d..63b3cfd 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -4,20 +4,18 @@ import ( "context" "database/sql" "embed" - "go.unistack.org/unistack-org/pkgdash/models" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" - "go.unistack.org/unistack-org/pkgdash/storage/postgres" - "go.unistack.org/unistack-org/pkgdash/storage/sqlite" cmsstorage "go.unistack.org/cms-service/storage" + "go.unistack.org/unistack-org/pkgdash/models" + pb "go.unistack.org/unistack-org/pkgdash/proto" + "go.unistack.org/unistack-org/pkgdash/storage/postgres" + "go.unistack.org/unistack-org/pkgdash/storage/sqlite" ) //go:embed migrations var fs embed.FS -var ( - storages = cmsstorage.NewStorageInterface() -) +var storages = cmsstorage.NewStorageInterface() func init() { storages.RegisterStorage("postgres", postgres.NewStorageFS(fs)) @@ -29,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) diff --git a/storage/storage_test.go b/storage/storage_test.go index 8e5f91f..2b4769e 100644 --- a/storage/storage_test.go +++ b/storage/storage_test.go @@ -4,7 +4,7 @@ import ( "context" "database/sql" "fmt" - pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate" + pb "go.unistack.org/unistack-org/pkgdash/proto" "go.unistack.org/unistack-org/pkgdash/storage/sqlite" "testing" )