Merge branch 'rewrite'

# Conflicts:
#	cmd/script/main.go
#	go.mod
#	go.sum
#	handler/handlers.go
#	handler/writer.go
#	proto/go_generate/dashboard.pb.go
#	proto/micro/dashboard_micro.pb.go
#	proto/micro/dashboard_micro_http.pb.go
#	proto/pkgdash.pb.validate.go
#	service/client_git/client.go
#	service/client_git/client_test.go
#	service/service.go
#	storage/postgres/quries.go
#	storage/postgres/storage.go
#	storage/sqlite/storage.go
#	storage/storage.go
#	storage/storage_test.go
This commit is contained in:
Денис Евстигнеев 2023-08-12 15:23:14 +03:00
commit 85f4b92fa7
29 changed files with 2072 additions and 1688 deletions

View File

@ -19,5 +19,4 @@ func main() {
if err = svc.Run(); err != nil {
logger.Fatal(ctx, err)
}
}

View File

@ -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"
)

12
generate.go Normal file
View File

@ -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"
)

12
generate.sh Executable file
View File

@ -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

43
go.mod
View File

@ -12,13 +12,13 @@ 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-client-http/v4 v4.0.2
go.unistack.org/micro-config-flag/v3 v3.8.9
go.unistack.org/micro-proto/v3 v3.3.1
go.unistack.org/micro-server-http/v3 v3.11.6
go.unistack.org/micro/v3 v3.10.24
go.unistack.org/micro-proto/v4 v4.0.1
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
)
@ -31,23 +31,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/imdario/mergo v0.3.15 // 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 +58,32 @@ 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-service/v3 v3.8.1 // indirect
go.unistack.org/micro-proto/v3 v3.3.1 // indirect
go.unistack.org/micro-server-http/v3 v3.11.6 // indirect
go.unistack.org/micro/v3 v3.10.18 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/net v0.12.0 // indirect
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

71
go.sum
View File

@ -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=
@ -578,8 +579,8 @@ github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
@ -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,14 +1014,14 @@ 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=
go.unistack.org/micro-broker-service/v3 v3.8.2/go.mod h1:qTlBl4vdJSl66SFIjdjOWFWKO0BFQ2ImbwiPCti/H8M=
go.unistack.org/micro-client-http/v3 v3.9.3 h1:5AicVsSwzAbIa1mpi99g5JhhDakUkgMV6e4F/Xyu3jI=
go.unistack.org/micro-client-http/v3 v3.9.3/go.mod h1:3zB0iVaYhG/xi0r/YvyTE422dOOOx1PAaiWlD2GSBlM=
go.unistack.org/micro-client-http/v4 v4.0.2 h1:0xsm2RCRWMfb1moeXQQ220uz52XE0R/PZvM9was/4lM=
go.unistack.org/micro-client-http/v4 v4.0.2/go.mod h1:Z9QT/upeqrp/rXVkL0lk6AzrkTdes0W3QlFlZ+ytkqM=
go.unistack.org/micro-codec-yaml/v3 v3.10.0 h1:cnNiWQZ3F+jsCX9DhEHBdIw8CjBItxb+TrKGGdlQ8F8=
go.unistack.org/micro-codec-yaml/v3 v3.10.0/go.mod h1:UzwC3QZZ6+PgKSudlGZNLkugXzOFkp3sxhs/CctEwBY=
go.unistack.org/micro-config-env/v3 v3.8.5 h1:k0BKpQflJ9mutzK//VcYw4XAKlKHTvg2GtkHTrEjbko=
@ -1044,11 +1034,19 @@ go.unistack.org/micro-config-service/v3 v3.8.1 h1:Q+RPWCb88VGz5+EQUx45Xeysf+Mon9
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 +1074,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 +1531,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 +1562,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=

View File

@ -2,9 +2,10 @@ package encoders
import (
"encoding/json"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
"net/http"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"github.com/pkg/errors"
)

View File

@ -2,7 +2,7 @@ package encoders
import (
"github.com/pkg/errors"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"io"

View File

@ -3,18 +3,19 @@ package handler
import (
"context"
"encoding/json"
"io"
"net/http"
"net/url"
cmsstorage "go.unistack.org/cms-service/storage"
"go.unistack.org/micro/v3"
"go.unistack.org/micro/v3/errors"
"go.unistack.org/micro/v4"
"go.unistack.org/micro/v4/errors"
"go.unistack.org/unistack-org/pkgdash/config"
pb "go.unistack.org/unistack-org/pkgdash/proto/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"
"net/http"
"net/url"
)
type Handler struct {

View File

@ -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 (

View File

@ -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 {

View File

@ -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

View File

@ -1,9 +0,0 @@
//go:build tools
// +build tools
package proto
import (
_ "github.com/envoyproxy/protoc-gen-validate"
_ "go.unistack.org/micro-proto/v3"
)

File diff suppressed because it is too large Load Diff

View File

@ -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
}

View File

@ -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...)...))
}

1487
proto/pkgdash.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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"
@ -89,7 +89,6 @@ func (m *ErrorRsp) validate(all bool) error {
if len(errors) > 0 {
return ErrorRspMultiError(errors)
}
return nil
}
@ -195,7 +194,6 @@ func (m *Error) validate(all bool) error {
if len(errors) > 0 {
return ErrorMultiError(errors)
}
return nil
}
@ -326,7 +324,6 @@ func (m *Package) validate(all bool) error {
if len(errors) > 0 {
return PackageMultiError(errors)
}
return nil
}
@ -479,7 +476,6 @@ func (m *Module) validate(all bool) error {
if len(errors) > 0 {
return ModuleMultiError(errors)
}
return nil
}
@ -621,7 +617,6 @@ func (m *Issue) validate(all bool) error {
if len(errors) > 0 {
return IssueMultiError(errors)
}
return nil
}
@ -765,7 +760,6 @@ func (m *Comment) validate(all bool) error {
if len(errors) > 0 {
return CommentMultiError(errors)
}
return nil
}
@ -864,7 +858,6 @@ func (m *ListPackageReq) validate(all bool) error {
if len(errors) > 0 {
return ListPackageReqMultiError(errors)
}
return nil
}
@ -998,7 +991,6 @@ func (m *ListPackageRsp) validate(all bool) error {
if len(errors) > 0 {
return ListPackageRspMultiError(errors)
}
return nil
}
@ -1218,7 +1210,6 @@ func (m *UpdatePackageReq) validate(all bool) error {
if len(errors) > 0 {
return UpdatePackageReqMultiError(errors)
}
return nil
}
@ -1329,7 +1320,6 @@ func (m *UpdatePackageRsp) validate(all bool) error {
if len(errors) > 0 {
return UpdatePackageRspMultiError(errors)
}
return nil
}
@ -1404,6 +1394,117 @@ 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.
@ -1471,7 +1572,6 @@ func (m *AddCommentReq) validate(all bool) error {
if len(errors) > 0 {
return AddCommentReqMultiError(errors)
}
return nil
}
@ -1582,7 +1682,6 @@ func (m *AddCommentRsp) validate(all bool) error {
if len(errors) > 0 {
return AddCommentRspMultiError(errors)
}
return nil
}
@ -1762,7 +1861,6 @@ func (m *AddPackageReq) validate(all bool) error {
if len(errors) > 0 {
return AddPackageReqMultiError(errors)
}
return nil
}
@ -1862,7 +1960,6 @@ func (m *AddPackageRsp) validate(all bool) error {
if len(errors) > 0 {
return AddPackageRspMultiError(errors)
}
return nil
}
@ -1962,7 +2059,6 @@ func (m *GetModuleReq) validate(all bool) error {
if len(errors) > 0 {
return GetModuleReqMultiError(errors)
}
return nil
}
@ -2095,7 +2191,6 @@ func (m *GetModuleRsp) validate(all bool) error {
if len(errors) > 0 {
return GetModuleRspMultiError(errors)
}
return nil
}

View File

@ -1,18 +1,83 @@
syntax = "proto3";
package proto;
package pkgdash;
option go_package = "go.unistack.org/unistack-org/pkgdash/proto/go_generate;go_generate";
option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb";
import "api/annotations.proto";
import "openapiv3/annotations.proto";
import "validate/validate.proto";
import "google/protobuf/wrappers.proto";
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) {};
service PkgdashService {
rpc ListPackage(ListPackageReq) 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 {
@ -75,6 +140,11 @@ 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 {
google.protobuf.UInt64Value idPackage = 1 [(validate.rules).message.required = true];
string text = 2;
@ -89,6 +159,7 @@ message AddPackageReq {
google.protobuf.StringValue url = 2 [(validate.rules).message.required = true];
repeated uint64 modules = 3;
}
message AddPackageRsp{}
message GetModuleReq {

33
proto/pkgdash_micro.pb.go Normal file
View File

@ -0,0 +1,33 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v4.0.2
// - protoc v4.23.4
// source: pkgdash.proto
package pkgdashpb
import (
context "context"
_ "go.unistack.org/micro/v4/client"
options "go.unistack.org/micro/v4/options"
)
var (
PkgdashServiceName = "PkgdashService"
)
type PkgdashServiceClient interface {
ListPackage(ctx context.Context, req *ListPackageReq, opts ...options.Option) (*ListPackageRsp, error)
UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error)
AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error)
AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error)
GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error)
}
type PkgdashServiceServer interface {
ListPackage(ctx context.Context, req *ListPackageReq, 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
}

View File

@ -0,0 +1,198 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v4.0.2
// source: pkgdash.proto
package pkgdashpb
import (
context "context"
v41 "go.unistack.org/micro-client-http/v4"
v4 "go.unistack.org/micro-server-http/v4"
client "go.unistack.org/micro/v4/client"
options "go.unistack.org/micro/v4/options"
server "go.unistack.org/micro/v4/server"
http "net/http"
)
var (
PkgdashServiceServerEndpoints = []v4.EndpointMetadata{
{
Name: "PkgdashService.ListPackage",
Path: "/v1/packages",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "PkgdashService.UpdatePackage",
Path: "/v1/package/{id}",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.AddComment",
Path: "/v1/package/{pkg}/comment",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.AddPackage",
Path: "/v1/package",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "PkgdashService.GetModule",
Path: "/v1/module",
Method: "GET",
Body: "",
Stream: false,
},
}
)
type pkgdashServiceClient struct {
c client.Client
name string
}
func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient {
return &pkgdashServiceClient{c: c, name: name}
}
func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *ListPackageReq, opts ...options.Option) (*ListPackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodGet),
v41.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 ...options.Option) (*UpdatePackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodPost),
v41.Path("/v1/package/{id}"),
v41.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 ...options.Option) (*AddCommentRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodPost),
v41.Path("/v1/package/{pkg}/comment"),
v41.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 ...options.Option) (*AddPackageRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodPost),
v41.Path("/v1/package"),
v41.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 ...options.Option) (*GetModuleRsp, error) {
errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{}
opts = append(opts,
v41.ErrorMap(errmap),
)
opts = append(opts,
v41.Method(http.MethodGet),
v41.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 *ListPackageReq, 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 ...options.Option) error {
type pkgdashService interface {
ListPackage(ctx context.Context, req *ListPackageReq, 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 []options.Option
nopts = append(nopts, v4.HandlerEndpoints(PkgdashServiceServerEndpoints))
return s.Handle(&PkgdashService{h}, append(nopts, opts...)...)
}

View File

@ -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"

View File

@ -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"

View File

@ -2,28 +2,26 @@ package service
import (
"context"
"net/http"
cmsservice "go.unistack.org/cms-service"
cmsstorage "go.unistack.org/cms-service/storage"
httpsrv "go.unistack.org/micro-server-http/v4"
"go.unistack.org/micro/v4"
"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"
"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()
@ -32,20 +30,11 @@ func NewService(ctx context.Context) (micro.Service, error) {
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()
}
mgsrv := httpsrv.NewServer(
options.Register(reg),
)
svc := micro.NewService(
micro.Register(reg),
micro.Router(router),
micro.Config(cs...),
)
@ -75,9 +64,9 @@ func NewService(ctx context.Context) (micro.Service, error) {
return err
}
if err = svc.Server("http").Init(
server.Address(cfg.App.Address),
server.Name(cfg.Service.Name),
if err := svc.Server("http").Init(
options.Address(cfg.App.Address),
options.Name(cfg.Service.Name),
server.Version(cfg.Service.Version),
); err != nil {
return err

View File

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

View File

@ -6,14 +6,14 @@ import (
"embed"
"errors"
"fmt"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"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"
)

View File

@ -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 (

View File

@ -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))

View File

@ -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"
)