use worker
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
78f0ae14d7
commit
0e18a63f10
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
|||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
go build -o bin/app -mod=readonly git.unistack.org/unistack-org/pkgdash/cmd/pkgdash
|
CGO_ENABLED=0 go build -o bin/app -mod=readonly git.unistack.org/unistack-org/pkgdash/cmd/pkgdash
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
|
@ -7,21 +7,27 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
appconfig "git.unistack.org/unistack-org/pkgdash/internal/config"
|
appconfig "git.unistack.org/unistack-org/pkgdash/internal/config"
|
||||||
|
"git.unistack.org/unistack-org/pkgdash/internal/database"
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/handler"
|
"git.unistack.org/unistack-org/pkgdash/internal/handler"
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/service/client_git"
|
"git.unistack.org/unistack-org/pkgdash/internal/storage"
|
||||||
|
_ "git.unistack.org/unistack-org/pkgdash/internal/storage/sqlite"
|
||||||
|
"git.unistack.org/unistack-org/pkgdash/internal/worker"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
jsoncodec "go.unistack.org/micro-codec-json/v4"
|
jsoncodec "go.unistack.org/micro-codec-json/v4"
|
||||||
|
jsonpbcodec "go.unistack.org/micro-codec-jsonpb/v4"
|
||||||
yamlcodec "go.unistack.org/micro-codec-yaml/v4"
|
yamlcodec "go.unistack.org/micro-codec-yaml/v4"
|
||||||
envconfig "go.unistack.org/micro-config-env/v4"
|
envconfig "go.unistack.org/micro-config-env/v4"
|
||||||
fileconfig "go.unistack.org/micro-config-file/v4"
|
fileconfig "go.unistack.org/micro-config-file/v4"
|
||||||
vaultconfig "go.unistack.org/micro-config-vault/v4"
|
vaultconfig "go.unistack.org/micro-config-vault/v4"
|
||||||
zlogger "go.unistack.org/micro-logger-zerolog/v4"
|
zlogger "go.unistack.org/micro-logger-zerolog/v4"
|
||||||
|
victoriameter "go.unistack.org/micro-meter-victoriametrics/v4"
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
healthhandler "go.unistack.org/micro-server-http/v4/handler/health"
|
healthhandler "go.unistack.org/micro-server-http/v4/handler/health"
|
||||||
meterhandler "go.unistack.org/micro-server-http/v4/handler/meter"
|
meterhandler "go.unistack.org/micro-server-http/v4/handler/meter"
|
||||||
"go.unistack.org/micro/v4"
|
"go.unistack.org/micro/v4"
|
||||||
"go.unistack.org/micro/v4/config"
|
"go.unistack.org/micro/v4/config"
|
||||||
"go.unistack.org/micro/v4/logger"
|
"go.unistack.org/micro/v4/logger"
|
||||||
|
"go.unistack.org/micro/v4/meter"
|
||||||
"go.unistack.org/micro/v4/options"
|
"go.unistack.org/micro/v4/options"
|
||||||
"go.unistack.org/micro/v4/server"
|
"go.unistack.org/micro/v4/server"
|
||||||
rutil "go.unistack.org/micro/v4/util/reflect"
|
rutil "go.unistack.org/micro/v4/util/reflect"
|
||||||
@ -38,7 +44,7 @@ func main() {
|
|||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
logger.DefaultLogger = zlogger.NewLogger(zlogger.ReportCaller(), logger.WithLevel(logger.DebugLevel), logger.WithCallerSkipCount(3))
|
logger.DefaultLogger = zlogger.NewLogger(zlogger.ReportCaller(), logger.WithLevel(logger.DebugLevel), logger.WithCallerSkipCount(4))
|
||||||
if err := logger.DefaultLogger.Init(); err != nil {
|
if err := logger.DefaultLogger.Init(); err != nil {
|
||||||
logger.Fatalf(ctx, "failed to init logger")
|
logger.Fatalf(ctx, "failed to init logger")
|
||||||
}
|
}
|
||||||
@ -87,9 +93,17 @@ func main() {
|
|||||||
logger.Fatalf(ctx, "failed to validate config: %v", err)
|
logger.Fatalf(ctx, "failed to validate config: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meter.DefaultMeter = victoriameter.NewMeter(
|
||||||
|
meter.Path(cfg.Meter.Path),
|
||||||
|
meter.WriteFDMetrics(true),
|
||||||
|
meter.WriteProcessMetrics(true),
|
||||||
|
options.Address(cfg.Meter.Addr),
|
||||||
|
)
|
||||||
|
|
||||||
svc := micro.NewService()
|
svc := micro.NewService()
|
||||||
|
|
||||||
if err := svc.Init(
|
if err := svc.Init(
|
||||||
|
micro.Server(httpsrv.NewServer()),
|
||||||
micro.Name(cfg.Server.Name),
|
micro.Name(cfg.Server.Name),
|
||||||
micro.Version(cfg.Server.Version),
|
micro.Version(cfg.Server.Version),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
@ -100,13 +114,30 @@ func main() {
|
|||||||
options.Address(cfg.Server.Addr),
|
options.Address(cfg.Server.Addr),
|
||||||
options.Name(cfg.Server.Name),
|
options.Name(cfg.Server.Name),
|
||||||
server.Version(cfg.Server.Version),
|
server.Version(cfg.Server.Version),
|
||||||
|
options.Codecs("application/json", jsonpbcodec.NewCodec()),
|
||||||
|
options.Address(cfg.Server.Addr),
|
||||||
|
options.Context(ctx),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
logger.Fatalf(ctx, "failed to init service: %v", err)
|
logger.Fatalf(ctx, "failed to init service: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
h := handler.NewHandler(svc, client_git.NewClient(5))
|
if err := database.ParseDSN(cfg.Database); err != nil {
|
||||||
if err := h.Init(svc.Options().Context); err != nil {
|
logger.Fatalf(ctx, "failed to init database: %v", err)
|
||||||
logger.Fatalf(ctx, "failed to init handler: %v", err)
|
}
|
||||||
|
|
||||||
|
db, err := database.Connect(ctx, cfg.Database, logger.DefaultLogger)
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatalf(ctx, "failed to connect database: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
store, err := storage.NewStorage(cfg.Database.Type, db)
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatalf(ctx, "failed to init storage: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
h, err := handler.NewHandler(store)
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatalf(ctx, "failed to create handler: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log := logger.NewLogger(
|
log := logger.NewLogger(
|
||||||
@ -179,4 +210,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
worker.Run(ctx, store, time.Duration(cfg.App.CheckInterval))
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err = svc.Run(); err != nil {
|
||||||
|
logger.Fatalf(ctx, "failed to run svc: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
BIN
database.db
Normal file
BIN
database.db
Normal file
Binary file not shown.
33
go.mod
33
go.mod
@ -7,22 +7,35 @@ require (
|
|||||||
github.com/go-git/go-git/v5 v5.8.1
|
github.com/go-git/go-git/v5 v5.8.1
|
||||||
github.com/golang-migrate/migrate/v4 v4.15.1
|
github.com/golang-migrate/migrate/v4 v4.15.1
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/jackc/pgtype v1.14.0
|
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c
|
||||||
|
github.com/jmoiron/sqlx v1.3.1
|
||||||
github.com/lib/pq v1.10.2
|
github.com/lib/pq v1.10.2
|
||||||
github.com/mattn/go-sqlite3 v1.14.16
|
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
|
go.unistack.org/micro-client-http/v4 v4.0.2
|
||||||
|
go.unistack.org/micro-codec-json/v4 v4.0.0
|
||||||
|
go.unistack.org/micro-codec-jsonpb/v4 v4.0.0
|
||||||
|
go.unistack.org/micro-codec-yaml/v4 v4.0.0
|
||||||
|
go.unistack.org/micro-config-env/v4 v4.0.1
|
||||||
|
go.unistack.org/micro-config-file/v4 v4.0.1
|
||||||
go.unistack.org/micro-config-flag/v4 v4.0.2
|
go.unistack.org/micro-config-flag/v4 v4.0.2
|
||||||
|
go.unistack.org/micro-config-vault/v4 v4.0.2
|
||||||
|
go.unistack.org/micro-logger-zerolog/v4 v4.0.3
|
||||||
|
go.unistack.org/micro-meter-victoriametrics/v4 v4.0.1
|
||||||
go.unistack.org/micro-proto/v4 v4.0.1
|
go.unistack.org/micro-proto/v4 v4.0.1
|
||||||
go.unistack.org/micro-server-http/v4 v4.0.11
|
go.unistack.org/micro-server-http/v4 v4.0.12
|
||||||
go.unistack.org/micro/v4 v4.0.7
|
go.unistack.org/micro/v4 v4.0.7
|
||||||
go.unistack.org/protoc-gen-go-micro/v4 v4.0.6
|
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7
|
||||||
golang.org/x/mod v0.12.0
|
golang.org/x/mod v0.12.0
|
||||||
golang.org/x/sync v0.3.0
|
golang.org/x/sync v0.3.0
|
||||||
google.golang.org/protobuf v1.31.0
|
google.golang.org/protobuf v1.31.0
|
||||||
go.unistack.org/micro-client-http/v4 v4.0.2
|
modernc.org/sqlite v1.21.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
dario.cat/mergo v1.0.0 // indirect
|
dario.cat/mergo v1.0.0 // indirect
|
||||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
|
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
|
||||||
|
github.com/VictoriaMetrics/metrics v1.24.0 // indirect
|
||||||
github.com/acomagu/bufpipe v1.0.4 // indirect
|
github.com/acomagu/bufpipe v1.0.4 // indirect
|
||||||
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
|
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
|
||||||
github.com/cloudflare/circl v1.3.3 // indirect
|
github.com/cloudflare/circl v1.3.3 // indirect
|
||||||
@ -54,7 +67,7 @@ require (
|
|||||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||||
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
|
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
|
||||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||||
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c // indirect
|
github.com/jackc/pgtype v1.14.0 // indirect
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||||
@ -71,11 +84,10 @@ require (
|
|||||||
github.com/sergi/go-diff v1.1.0 // indirect
|
github.com/sergi/go-diff v1.1.0 // indirect
|
||||||
github.com/skeema/knownhosts v1.2.0 // indirect
|
github.com/skeema/knownhosts v1.2.0 // indirect
|
||||||
github.com/spf13/afero v1.3.3 // indirect
|
github.com/spf13/afero v1.3.3 // indirect
|
||||||
github.com/stretchr/testify v1.8.3 // indirect
|
github.com/valyala/fastrand v1.1.0 // indirect
|
||||||
|
github.com/valyala/histogram v1.2.0 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||||
go.uber.org/atomic v1.6.0 // indirect
|
go.uber.org/atomic v1.6.0 // indirect
|
||||||
go.unistack.org/micro-config-vault/v4 v4.0.2 // indirect
|
|
||||||
go.unistack.org/micro-logger-zerolog/v4 v4.0.3 // indirect
|
|
||||||
golang.org/x/crypto v0.12.0 // indirect
|
golang.org/x/crypto v0.12.0 // indirect
|
||||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
|
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
|
||||||
golang.org/x/net v0.14.0 // indirect
|
golang.org/x/net v0.14.0 // indirect
|
||||||
@ -84,6 +96,7 @@ require (
|
|||||||
golang.org/x/time v0.3.0 // indirect
|
golang.org/x/time v0.3.0 // indirect
|
||||||
golang.org/x/tools v0.11.0 // indirect
|
golang.org/x/tools v0.11.0 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // 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
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
lukechampine.com/uint128 v1.3.0 // indirect
|
lukechampine.com/uint128 v1.3.0 // indirect
|
||||||
modernc.org/cc/v3 v3.40.0 // indirect
|
modernc.org/cc/v3 v3.40.0 // indirect
|
||||||
@ -92,7 +105,7 @@ require (
|
|||||||
modernc.org/mathutil v1.5.0 // indirect
|
modernc.org/mathutil v1.5.0 // indirect
|
||||||
modernc.org/memory v1.5.0 // indirect
|
modernc.org/memory v1.5.0 // indirect
|
||||||
modernc.org/opt v0.1.3 // indirect
|
modernc.org/opt v0.1.3 // indirect
|
||||||
modernc.org/sqlite v1.21.0 // indirect
|
|
||||||
modernc.org/strutil v1.1.3 // indirect
|
modernc.org/strutil v1.1.3 // indirect
|
||||||
modernc.org/token v1.1.0 // indirect
|
modernc.org/token v1.1.0 // indirect
|
||||||
|
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||||
)
|
)
|
||||||
|
64
go.sum
64
go.sum
@ -98,6 +98,8 @@ github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjA
|
|||||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||||
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
|
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
|
||||||
|
github.com/VictoriaMetrics/metrics v1.24.0 h1:ILavebReOjYctAGY5QU2F9X0MYvkcrG3aEn2RKa1Zkw=
|
||||||
|
github.com/VictoriaMetrics/metrics v1.24.0/go.mod h1:eFT25kvsTidQFHb6U0oa0rTrDRdz4xTYjpL8+UPohys=
|
||||||
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
|
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
|
||||||
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
||||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||||
@ -288,7 +290,6 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7
|
|||||||
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
||||||
github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
|
||||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
|
||||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||||
@ -355,6 +356,7 @@ 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/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/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/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
|
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
|
||||||
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
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/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
||||||
github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0=
|
github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0=
|
||||||
@ -407,8 +409,10 @@ github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8
|
|||||||
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
|
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
|
||||||
github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
|
github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
|
||||||
github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
|
github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
|
||||||
github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=
|
github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=
|
||||||
@ -566,16 +570,15 @@ 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/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/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 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.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 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||||
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
||||||
|
github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I=
|
||||||
github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
|
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.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.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 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
@ -682,6 +685,7 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht
|
|||||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||||
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
||||||
|
github.com/jmoiron/sqlx v1.3.1 h1:aLN7YINNZ7cYOPK3QC83dbM6KT0NMqVMw961TqrejlE=
|
||||||
github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
|
github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
|
||||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||||
@ -766,8 +770,6 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y
|
|||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
|
|
||||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
|
||||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
@ -775,7 +777,6 @@ github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vq
|
|||||||
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||||
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
|
||||||
@ -920,12 +921,9 @@ github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
|
|||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||||
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
|
||||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
||||||
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||||
github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w=
|
|
||||||
github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
|
||||||
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
|
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
|
||||||
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
|
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
@ -981,8 +979,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.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.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
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 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.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
@ -990,11 +986,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.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.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.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.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
|
||||||
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/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
|
||||||
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
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-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||||
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
|
||||||
@ -1007,6 +999,10 @@ github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/
|
|||||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
|
github.com/valyala/fastrand v1.1.0 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8=
|
||||||
|
github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||||
|
github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=
|
||||||
|
github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY=
|
||||||
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||||
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
|
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
|
||||||
@ -1067,24 +1063,32 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
|||||||
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
||||||
go.unistack.org/micro-client-http/v4 v4.0.2 h1:0xsm2RCRWMfb1moeXQQ220uz52XE0R/PZvM9was/4lM=
|
go.unistack.org/micro-client-http/v4 v4.0.2 h1:0xsm2RCRWMfb1moeXQQ220uz52XE0R/PZvM9was/4lM=
|
||||||
go.unistack.org/micro-client-http/v4 v4.0.2/go.mod h1:Z9QT/upeqrp/rXVkL0lk6AzrkTdes0W3QlFlZ+ytkqM=
|
go.unistack.org/micro-client-http/v4 v4.0.2/go.mod h1:Z9QT/upeqrp/rXVkL0lk6AzrkTdes0W3QlFlZ+ytkqM=
|
||||||
|
go.unistack.org/micro-codec-json/v4 v4.0.0 h1:lkX1s2abwoluGt1MhxxyaNWWOAAq8HZ8SLn9GhC45Pk=
|
||||||
|
go.unistack.org/micro-codec-json/v4 v4.0.0/go.mod h1:J0y3gsIGxQPVRgESbSKINtU7fOzigthyKil0zlwvNiA=
|
||||||
|
go.unistack.org/micro-codec-jsonpb/v4 v4.0.0 h1:6ODX2ohojEGjgQ9AOC99nQbtBDaArSwzK2qLPRPLHug=
|
||||||
|
go.unistack.org/micro-codec-jsonpb/v4 v4.0.0/go.mod h1:le+HSPPTutQlPgrgRCusNvQ57ujHRBr1ZBGJachZJzU=
|
||||||
|
go.unistack.org/micro-codec-yaml/v4 v4.0.0 h1:DK/+fA69gmnvYmGHe3kqVR0pukS8ank5lPG4MfdPQEk=
|
||||||
|
go.unistack.org/micro-codec-yaml/v4 v4.0.0/go.mod h1:UG4ouILbUfgNL7nvp7CpmD2IIzO8bQHjzDIahOvIAgM=
|
||||||
|
go.unistack.org/micro-config-env/v4 v4.0.1 h1:A7W+Xm4WEsN9O6isWncfwNWEUuSuCHgt+aovpZ4XhuE=
|
||||||
|
go.unistack.org/micro-config-env/v4 v4.0.1/go.mod h1:kJvyLrRbVRrsM1jTdl5lHy4u88PnlK2mskOZ3T57M/0=
|
||||||
|
go.unistack.org/micro-config-file/v4 v4.0.1 h1:J8CNyOvxfL4CnoL2xocvyWHo77UWF8wvH4To23E0gOA=
|
||||||
|
go.unistack.org/micro-config-file/v4 v4.0.1/go.mod h1:OSfm+CIjAgb0HRlXCZd0DUtDwV5zJKXMHduSiGsSY0M=
|
||||||
go.unistack.org/micro-config-flag/v4 v4.0.2 h1:qoDpT/H8a8TYZS9ucoNC0bLhNdp+UFlhnRWOuqIKAyo=
|
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-flag/v4 v4.0.2/go.mod h1:s0AYvz8rRtMHG2tkXoSmF8xFuHG12x3v1NERdMHDdiQ=
|
||||||
go.unistack.org/micro-config-vault/v4 v4.0.2 h1:QhDdtVJhQYmJZqAhsLRdnDZSZSzBunWX9a5l/WNKWNY=
|
go.unistack.org/micro-config-vault/v4 v4.0.2 h1:QhDdtVJhQYmJZqAhsLRdnDZSZSzBunWX9a5l/WNKWNY=
|
||||||
go.unistack.org/micro-config-vault/v4 v4.0.2/go.mod h1:0gWQVkncMwaG0wZPqC98HhS6AYOcXR0lmPG/roR6AcM=
|
go.unistack.org/micro-config-vault/v4 v4.0.2/go.mod h1:0gWQVkncMwaG0wZPqC98HhS6AYOcXR0lmPG/roR6AcM=
|
||||||
go.unistack.org/micro-logger-zerolog/v4 v4.0.2 h1:uKj/ZRiyEyiarImCm5Q3F6FvSvombZXB5aW4UGC2wVw=
|
|
||||||
go.unistack.org/micro-logger-zerolog/v4 v4.0.2/go.mod h1:EOtcMZ5WfBe9sUoYkWPurnY18uaUaeKDlMdSdaaqYz0=
|
|
||||||
go.unistack.org/micro-logger-zerolog/v4 v4.0.3 h1:ao6jGMo8jJG9WcOE738eqrWeabQaqpHMrLx+IniRDpI=
|
go.unistack.org/micro-logger-zerolog/v4 v4.0.3 h1:ao6jGMo8jJG9WcOE738eqrWeabQaqpHMrLx+IniRDpI=
|
||||||
go.unistack.org/micro-logger-zerolog/v4 v4.0.3/go.mod h1:w5iq5eT/ZUAczueU5lsChJK/evwofGcs3gz5rZwyivQ=
|
go.unistack.org/micro-logger-zerolog/v4 v4.0.3/go.mod h1:w5iq5eT/ZUAczueU5lsChJK/evwofGcs3gz5rZwyivQ=
|
||||||
|
go.unistack.org/micro-meter-victoriametrics/v4 v4.0.1 h1:r/AyMnwPLfP4l3Ja0X2NTOF8bvr6nIKqGAn33uAfqio=
|
||||||
|
go.unistack.org/micro-meter-victoriametrics/v4 v4.0.1/go.mod h1:QQo/Hs6XuvFQViCPAJ+CAlP2Q/+QppI0g2hiPfJ76UU=
|
||||||
go.unistack.org/micro-proto/v4 v4.0.1 h1:2RKHgtCOOcAFgKsnngGK5bqM/6MWXOjVCdw03dbuoF8=
|
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-proto/v4 v4.0.1/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec=
|
||||||
go.unistack.org/micro-server-http/v4 v4.0.9 h1:ye7LVVJSXlvE1TBvEuk4m3iZrAJk0rzs6vD2/qO/o2w=
|
go.unistack.org/micro-server-http/v4 v4.0.12 h1:cwlA9t/iNlQ/+LvYRxpreU3v3xRQYKQGVfvLpH3BM8I=
|
||||||
go.unistack.org/micro-server-http/v4 v4.0.9/go.mod h1:Cu4utVz2u98fychmjA2Ls6clXrja0sqH6Xu/JTamf7Y=
|
go.unistack.org/micro-server-http/v4 v4.0.12/go.mod h1:mQ18qN/1PxeTCKMNslh5qgswV582DP9QnsaI/ohFo/k=
|
||||||
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/micro/v4 v4.0.7 h1:2lwtZlHcSwgkahhFbkI4x1lOS79lw8uLHtcEhlFF+AM=
|
go.unistack.org/micro/v4 v4.0.7 h1:2lwtZlHcSwgkahhFbkI4x1lOS79lw8uLHtcEhlFF+AM=
|
||||||
go.unistack.org/micro/v4 v4.0.7/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
|
go.unistack.org/micro/v4 v4.0.7/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
|
||||||
go.unistack.org/protoc-gen-go-micro/v4 v4.0.6 h1:qe6huziuXqRnsgvDSiaT1DR20iL676w37PMkdBEjvEk=
|
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7 h1:c3CeBvjWV9MBrGGPaQCcHZrnuLY9sVJHv7vACI/dvuM=
|
||||||
go.unistack.org/protoc-gen-go-micro/v4 v4.0.6/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA=
|
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7/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-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-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
@ -1113,8 +1117,6 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
|||||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
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.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
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=
|
|
||||||
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
|
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
|
||||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -1229,8 +1231,6 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
|||||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||||
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
|
||||||
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
|
||||||
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||||
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
@ -1369,8 +1369,6 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
@ -1379,7 +1377,6 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
|
|||||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
|
|
||||||
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
|
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
@ -1393,8 +1390,6 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|||||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
|
||||||
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
|
||||||
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
|
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
|
||||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
@ -1661,6 +1656,7 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
@ -1764,3 +1760,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
|||||||
sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
||||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||||
|
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||||
|
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
type AppConfig struct{}
|
mtime "go.unistack.org/micro/v4/util/time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AppConfig struct {
|
||||||
|
CheckInterval mtime.Duration `json:"check_interval" yaml:"check_interval" default:"1d"`
|
||||||
|
}
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
Name string `json:"name" yaml:"name"`
|
Name string `json:"name" yaml:"name"`
|
||||||
@ -24,7 +30,7 @@ type TracerConfig struct {
|
|||||||
type VaultConfig struct {
|
type VaultConfig struct {
|
||||||
Addr string `env:"VAULT_ADDR" json:"addr" yaml:"addr" default:"http://127.0.0.1:8200"`
|
Addr string `env:"VAULT_ADDR" json:"addr" yaml:"addr" default:"http://127.0.0.1:8200"`
|
||||||
Token string `env:"VAULT_TOKEN" json:"-" yaml:"-"`
|
Token string `env:"VAULT_TOKEN" json:"-" yaml:"-"`
|
||||||
Path string `env:"VAULT_PATH" json:"-" yaml:"-" default:"apigw/data/authn"`
|
Path string `env:"VAULT_PATH" json:"-" yaml:"-" default:"pkgdash/data/pkgdash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MeterConfig struct {
|
type MeterConfig struct {
|
||||||
|
253
internal/database/database.go
Normal file
253
internal/database/database.go
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
package database
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
appconfig "git.unistack.org/unistack-org/pkgdash/internal/config"
|
||||||
|
"github.com/golang-migrate/migrate/v4"
|
||||||
|
"github.com/golang-migrate/migrate/v4/database"
|
||||||
|
mpgx "github.com/golang-migrate/migrate/v4/database/pgx"
|
||||||
|
msqlite "github.com/golang-migrate/migrate/v4/database/sqlite"
|
||||||
|
"github.com/golang-migrate/migrate/v4/source/iofs"
|
||||||
|
"github.com/jackc/pgx/v4"
|
||||||
|
"github.com/jackc/pgx/v4/stdlib"
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
|
_ "modernc.org/sqlite"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ParseDSN(cfg *appconfig.DatabaseConfig) error {
|
||||||
|
var err error
|
||||||
|
|
||||||
|
u, err := url.Parse(cfg.DSN)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
values := u.Query()
|
||||||
|
var value string
|
||||||
|
|
||||||
|
if value = values.Get("conn_max"); value != "" {
|
||||||
|
values.Del("conn_max")
|
||||||
|
maxOpenConns, err := strconv.Atoi(value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cfg.MaxOpenConns = maxOpenConns
|
||||||
|
cfg.MaxIdleConns = maxOpenConns / 2
|
||||||
|
}
|
||||||
|
|
||||||
|
if value = values.Get("conn_maxidle"); value != "" {
|
||||||
|
values.Del("conn_maxidle")
|
||||||
|
maxIdleConns, err := strconv.Atoi(value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cfg.MaxIdleConns = maxIdleConns
|
||||||
|
}
|
||||||
|
|
||||||
|
if value = values.Get("conn_lifetime"); value != "" {
|
||||||
|
values.Del("conn_lifetime")
|
||||||
|
connMaxLifetime, err := time.ParseDuration(value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cfg.ConnMaxLifetime = connMaxLifetime
|
||||||
|
}
|
||||||
|
|
||||||
|
if value = values.Get("conn_maxidletime"); value != "" {
|
||||||
|
values.Del("conn_maxidletime")
|
||||||
|
connMaxIdleTime, err := time.ParseDuration(value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cfg.ConnMaxIdleTime = connMaxIdleTime
|
||||||
|
}
|
||||||
|
|
||||||
|
if mtype := values.Get("migrate"); mtype != "" {
|
||||||
|
values.Del("migrate")
|
||||||
|
cfg.Migrate = mtype
|
||||||
|
}
|
||||||
|
|
||||||
|
switch u.Scheme {
|
||||||
|
case "postgres", "pgsql", "postgresql":
|
||||||
|
u.Scheme = "postgres"
|
||||||
|
case "sqlite", "sqlite3":
|
||||||
|
u.Scheme = "sqlite"
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unknown database %s", u.Scheme)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg.Type = u.Scheme
|
||||||
|
u.RawQuery = values.Encode()
|
||||||
|
|
||||||
|
cfg.ConnStr = u.String()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logger) (*sqlx.DB, error) {
|
||||||
|
var db *sqlx.DB
|
||||||
|
var err error
|
||||||
|
|
||||||
|
log.Infof(ctx, "connect to %s", cfg.Type)
|
||||||
|
switch cfg.Type {
|
||||||
|
case "postgres", "pgsql", "postgresql":
|
||||||
|
db, err = connectPostgres(ctx, cfg.ConnStr)
|
||||||
|
cfg.Type = "postgres"
|
||||||
|
case "sqlite", "sqlite3":
|
||||||
|
db, err = connectSqlite(ctx, cfg.ConnStr)
|
||||||
|
cfg.Type = "sqlite"
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unknown database type %s", cfg.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return db, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logger) (*sqlx.DB, error) {
|
||||||
|
db, err := connect(ctx, cfg, log)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
m, err := migratePrepare(ctx, db, log, cfg.Type)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
switch cfg.Migrate {
|
||||||
|
case "":
|
||||||
|
break
|
||||||
|
case "up":
|
||||||
|
logger.Infof(ctx, "migrate up")
|
||||||
|
err = m.Up()
|
||||||
|
case "down":
|
||||||
|
logger.Infof(ctx, "migrate down")
|
||||||
|
err = m.Down()
|
||||||
|
case "seed":
|
||||||
|
logger.Infof(ctx, "migrate seed")
|
||||||
|
if err = m.Drop(); err == nil {
|
||||||
|
err = m.Up()
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
logger.Infof(ctx, "migrate version")
|
||||||
|
v, verr := strconv.ParseUint(cfg.Type, 10, 64)
|
||||||
|
if verr != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = m.Migrate(uint(v))
|
||||||
|
}
|
||||||
|
|
||||||
|
if err == nil || err == migrate.ErrNoChange {
|
||||||
|
srcerr, dberr := m.Close()
|
||||||
|
if srcerr != nil {
|
||||||
|
err = srcerr
|
||||||
|
} else if dberr != nil {
|
||||||
|
err = dberr
|
||||||
|
} else {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
db, err = connect(ctx, cfg, log)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.SetConnMaxIdleTime(cfg.ConnMaxIdleTime)
|
||||||
|
db.SetConnMaxLifetime(cfg.ConnMaxLifetime)
|
||||||
|
db.SetMaxIdleConns(cfg.MaxIdleConns)
|
||||||
|
db.SetMaxOpenConns(cfg.MaxOpenConns)
|
||||||
|
|
||||||
|
return db, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func connectSqlite(ctx context.Context, connstr string) (*sqlx.DB, error) {
|
||||||
|
if !strings.Contains(connstr, ":memory:") {
|
||||||
|
return sqlx.ConnectContext(ctx, "sqlite", "file:"+connstr[9:])
|
||||||
|
}
|
||||||
|
return sqlx.ConnectContext(ctx, "sqlite", connstr[9:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func connectPostgres(ctx context.Context, connstr string) (*sqlx.DB, error) {
|
||||||
|
// parse connection string
|
||||||
|
dbConf, err := pgx.ParseConfig(connstr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// needed for pgbouncer
|
||||||
|
dbConf.RuntimeParams = map[string]string{
|
||||||
|
"standard_conforming_strings": "on",
|
||||||
|
"application_name": "authn",
|
||||||
|
}
|
||||||
|
|
||||||
|
// may be needed for pbbouncer, needs to check
|
||||||
|
// dbConf.PreferSimpleProtocol = true
|
||||||
|
// register pgx conn
|
||||||
|
connStr := stdlib.RegisterConnConfig(dbConf)
|
||||||
|
|
||||||
|
db, err := sqlx.ConnectContext(ctx, "pgx", connStr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return db, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func migratePrepare(ctx context.Context, db *sqlx.DB, log logger.Logger, dbtype string) (*migrate.Migrate, error) {
|
||||||
|
var driver database.Driver
|
||||||
|
var err error
|
||||||
|
|
||||||
|
switch dbtype {
|
||||||
|
case "postgres":
|
||||||
|
driver, err = mpgx.WithInstance(db.DB, &mpgx.Config{
|
||||||
|
DatabaseName: "pkgdash",
|
||||||
|
MigrationsTable: "schema_migrations",
|
||||||
|
})
|
||||||
|
case "sqlite":
|
||||||
|
driver, err = msqlite.WithInstance(db.DB, &msqlite.Config{
|
||||||
|
DatabaseName: "pkgdash",
|
||||||
|
MigrationsTable: "schema_migrations",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
source, err := iofs.New(assets, "migrations/"+dbtype)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
m, err := migrate.NewWithInstance("fs", source, "apigw", driver)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
m.Log = &mLog{ctx: ctx, l: log}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type mLog struct {
|
||||||
|
ctx context.Context
|
||||||
|
l logger.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *mLog) Verbose() bool {
|
||||||
|
return l.l.V(logger.DebugLevel)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *mLog) Printf(format string, v ...interface{}) {
|
||||||
|
l.l.Infof(l.ctx, format, v...)
|
||||||
|
}
|
8
internal/database/embed.go
Normal file
8
internal/database/embed.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package database
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed migrations
|
||||||
|
var assets embed.FS
|
@ -0,0 +1,4 @@
|
|||||||
|
drop table if exists packages;
|
||||||
|
drop table if exists modules;
|
||||||
|
drop table if exists issues;
|
||||||
|
drop table if exists comments;
|
@ -0,0 +1,38 @@
|
|||||||
|
create table if not exists comments (
|
||||||
|
id integer primary key autoincrement not null,
|
||||||
|
comment text,
|
||||||
|
package integer not null,
|
||||||
|
created timestamp not null default current_timestamp,
|
||||||
|
updated timestamp not null default current_timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
create table if not exists modules (
|
||||||
|
id integer primary key autoincrement not null,
|
||||||
|
name varchar not null ,
|
||||||
|
version varchar not null,
|
||||||
|
package integer not null,
|
||||||
|
last_version varchar not null,
|
||||||
|
created timestamp not null default current_timestamp,
|
||||||
|
updated timestamp not null default current_timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
create table if not exists issues (
|
||||||
|
id integer primary key autoincrement not null,
|
||||||
|
status integer default 0,
|
||||||
|
comment varchar,
|
||||||
|
created timestamp not null default current_timestamp,
|
||||||
|
updated timestamp not null default current_timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
create table if not exists packages (
|
||||||
|
id integer primary key autoincrement not null,
|
||||||
|
name varchar not null,
|
||||||
|
url varchar not null,
|
||||||
|
modules integer default 0,
|
||||||
|
issues integer default 0,
|
||||||
|
comments integer default 0,
|
||||||
|
created timestamp not null default current_timestamp,
|
||||||
|
updated timestamp not null default current_timestamp,
|
||||||
|
status integer default 1,
|
||||||
|
last_check timestamp
|
||||||
|
);
|
@ -6,13 +6,13 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq, rsp *pb.CommentsCreateRsp) error {
|
func (h *Handler) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq, rsp *pb.CommentsCreateRsp) error {
|
||||||
logger := h.svc.Logger()
|
|
||||||
logger.Debug(ctx, "Start AddComment")
|
logger.Debug(ctx, "Start AddComment")
|
||||||
|
|
||||||
err := req.Validate()
|
err := req.Validate()
|
||||||
|
@ -6,12 +6,12 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq, rsp *pb.CommentsDeleteRsp) error {
|
func (h *Handler) CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq, rsp *pb.CommentsDeleteRsp) error {
|
||||||
logger := h.svc.Logger()
|
|
||||||
logger.Debug(ctx, "Start AddComment")
|
logger.Debug(ctx, "Start AddComment")
|
||||||
|
|
||||||
err := req.Validate()
|
err := req.Validate()
|
||||||
|
@ -4,13 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) CommentsList(ctx context.Context, req *pb.CommentsListReq, rsp *pb.CommentsListRsp) error {
|
func (h *Handler) CommentsList(ctx context.Context, req *pb.CommentsListReq, rsp *pb.CommentsListRsp) error {
|
||||||
logger := h.svc.Logger()
|
|
||||||
logger.Debug(ctx, "Start GetModule")
|
logger.Debug(ctx, "Start GetModule")
|
||||||
|
|
||||||
err := req.Validate()
|
err := req.Validate()
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"go.unistack.org/micro/v4"
|
|
||||||
cligit "git.unistack.org/unistack-org/pkgdash/internal/service/client_git"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/storage"
|
"git.unistack.org/unistack-org/pkgdash/internal/storage"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
"google.golang.org/protobuf/encoding/protojson"
|
"github.com/google/uuid"
|
||||||
|
jsonpbcodec "go.unistack.org/micro-codec-jsonpb/v4"
|
||||||
|
"go.unistack.org/micro/v4/codec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
svc micro.Service
|
store storage.Storage
|
||||||
store storage.Storage
|
codec codec.Codec
|
||||||
|
|
||||||
protojson.MarshalOptions
|
|
||||||
protojson.UnmarshalOptions
|
|
||||||
|
|
||||||
git cligit.Client
|
|
||||||
chanUrl chan *pb.PackagesCreateReq
|
chanUrl chan *pb.PackagesCreateReq
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,25 +44,11 @@ func NewValidationError(err error) *pb.ErrorRsp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHandler(svc micro.Service, client cligit.Client) *Handler {
|
func NewHandler(store storage.Storage) (*Handler, error) {
|
||||||
h := &Handler{
|
h := &Handler{
|
||||||
svc: svc,
|
codec: jsonpbcodec.NewCodec(),
|
||||||
git: client,
|
store: store,
|
||||||
}
|
|
||||||
h.EmitUnpopulated = true
|
|
||||||
h.UseProtoNames = false
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *Handler) Init(ctx context.Context) error {
|
|
||||||
store, err := storage.FromContext(h.svc.Options().Context)
|
|
||||||
if err != nil {
|
|
||||||
return errors.New("missing storage")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h.chanUrl = h.git.Run(ctx, store)
|
return h, nil
|
||||||
|
|
||||||
h.store = store
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) ModulesList(ctx context.Context, req *pb.ModulesListReq, rsp *pb.ModulesListRsp) error {
|
func (h *Handler) ModulesList(ctx context.Context, req *pb.ModulesListReq, rsp *pb.ModulesListRsp) error {
|
||||||
logger := h.svc.Logger()
|
|
||||||
logger.Debug(ctx, "Start GetModule")
|
logger.Debug(ctx, "Start GetModule")
|
||||||
|
|
||||||
err := req.Validate()
|
err := req.Validate()
|
||||||
|
@ -4,29 +4,30 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq, rsp *pb.PackagesCreateRsp) error {
|
func (h *Handler) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq, rsp *pb.PackagesCreateRsp) error {
|
||||||
logger := h.svc.Logger()
|
logger.Debug(ctx, "PackagesCreate handler start")
|
||||||
logger.Debug(ctx, "Start AddPackage")
|
|
||||||
|
|
||||||
err := req.Validate()
|
if err := req.Validate(); err != nil {
|
||||||
|
logger.Error(ctx, err)
|
||||||
|
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
|
||||||
|
return httpsrv.SetError(NewValidationError(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg, err := h.store.PackagesCreate(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(ctx, err)
|
logger.Error(ctx, err)
|
||||||
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
|
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
|
||||||
return httpsrv.SetError(NewValidationError(err))
|
return httpsrv.SetError(NewValidationError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.git.IsClose() {
|
rsp.Package = models.NewPackage(pkg)
|
||||||
logger.Error(ctx, "chan is closed")
|
|
||||||
} else {
|
|
||||||
h.chanUrl <- req
|
|
||||||
}
|
|
||||||
|
|
||||||
rsp.Status = "Sent"
|
logger.Debug(ctx, "PackagesCreate handler stop")
|
||||||
|
|
||||||
logger.Debug(ctx, "Success finish addPackage")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq, rsp *pb.PackagesDeleteRsp) error {
|
func (h *Handler) PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq, rsp *pb.PackagesDeleteRsp) error {
|
||||||
logger := h.svc.Logger()
|
|
||||||
logger.Debug(ctx, "Start UpdatePackage")
|
logger.Debug(ctx, "Start UpdatePackage")
|
||||||
|
|
||||||
if err := req.Validate(); err != nil {
|
if err := req.Validate(); err != nil {
|
||||||
|
@ -4,14 +4,14 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) PackagesList(ctx context.Context, req *pb.PackagesListReq, rsp *pb.PackagesListRsp) error {
|
func (h *Handler) PackagesList(ctx context.Context, req *pb.PackagesListReq, rsp *pb.PackagesListRsp) error {
|
||||||
logger := h.svc.Logger()
|
logger.Debug(ctx, "PackagesList handler start")
|
||||||
logger.Debug(ctx, "Start getListPackage")
|
|
||||||
|
|
||||||
packages, err := h.store.PackagesList(ctx, req)
|
packages, err := h.store.PackagesList(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -23,6 +23,6 @@ func (h *Handler) PackagesList(ctx context.Context, req *pb.PackagesListReq, rsp
|
|||||||
for _, pkg := range packages {
|
for _, pkg := range packages {
|
||||||
rsp.Packages = append(rsp.Packages, models.NewPackage(pkg))
|
rsp.Packages = append(rsp.Packages, models.NewPackage(pkg))
|
||||||
}
|
}
|
||||||
logger.Debug(ctx, "Success finish getListPackage")
|
logger.Debug(ctx, "PackagesList handler stop")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
33
internal/handler/packages_lookup.go
Normal file
33
internal/handler/packages_lookup.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (h *Handler) PackagesLookup(ctx context.Context, req *pb.PackagesLookupReq, rsp *pb.PackagesLookupRsp) error {
|
||||||
|
logger.Debug(ctx, "Start PackagesLookup")
|
||||||
|
|
||||||
|
if err := req.Validate(); err != nil {
|
||||||
|
logger.Error(ctx, err)
|
||||||
|
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
|
||||||
|
return httpsrv.SetError(NewValidationError(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg, err := h.store.PackagesLookup(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(ctx, err)
|
||||||
|
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||||
|
return httpsrv.SetError(NewInternalError(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
rsp.Package = models.NewPackage(pkg)
|
||||||
|
|
||||||
|
logger.Debug(ctx, "Success finish PackagesLookup")
|
||||||
|
return nil
|
||||||
|
}
|
@ -4,12 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
httpsrv "go.unistack.org/micro-server-http/v4"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq, rsp *pb.PackagesUpdateRsp) error {
|
func (h *Handler) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq, rsp *pb.PackagesUpdateRsp) error {
|
||||||
logger := h.svc.Logger()
|
|
||||||
logger.Debug(ctx, "Start UpdatePackage")
|
logger.Debug(ctx, "Start UpdatePackage")
|
||||||
|
|
||||||
if err := req.Validate(); err != nil {
|
if err := req.Validate(); err != nil {
|
||||||
@ -18,13 +19,14 @@ func (h *Handler) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq,
|
|||||||
return httpsrv.SetError(NewValidationError(err))
|
return httpsrv.SetError(NewValidationError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := h.store.PackagesUpdate(ctx, req); err != nil {
|
pkg, err := h.store.PackagesUpdate(ctx, req)
|
||||||
|
if err != nil {
|
||||||
logger.Error(ctx, err)
|
logger.Error(ctx, err)
|
||||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||||
return httpsrv.SetError(NewInternalError(err))
|
return httpsrv.SetError(NewInternalError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// rsp.Id = req.Id
|
rsp.Package = models.NewPackage(pkg)
|
||||||
|
|
||||||
logger.Debug(ctx, "Success finish UpdatePackage")
|
logger.Debug(ctx, "Success finish UpdatePackage")
|
||||||
return nil
|
return nil
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
@ -8,18 +9,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Package struct {
|
type Package struct {
|
||||||
Name string `db:"name" json:"name"`
|
Created time.Time `db:"created"`
|
||||||
URL string `db:"url" json:"url"`
|
Updated time.Time `db:"updated"`
|
||||||
Modules []uint64 `db:"modules" json:"modules"`
|
Name string `db:"name"`
|
||||||
Issues []uint64 `db:"issues" json:"issues,omitempty"`
|
URL string `db:"url"`
|
||||||
Comments []uint64 `db:"comments" json:"comments,omitempty"`
|
Modules uint64 `db:"modules"`
|
||||||
ID uint64 `db:"id" json:"id"`
|
Issues uint64 `db:"issues"`
|
||||||
Created time.Time `db:"created" json:"created"`
|
Comments uint64 `db:"comments"`
|
||||||
Updated time.Time `db:"updated" json:"updated,omitempty"`
|
ID uint64 `db:"id"`
|
||||||
|
Status uint64 `db:"status"`
|
||||||
|
LastCheck sql.NullTime `db:"last_check"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPackage(pkg *Package) *pb.Package {
|
func NewPackage(pkg *Package) *pb.Package {
|
||||||
return &pb.Package{
|
rsp := &pb.Package{
|
||||||
Name: pkg.Name,
|
Name: pkg.Name,
|
||||||
Url: pkg.URL,
|
Url: pkg.URL,
|
||||||
Modules: pkg.Modules,
|
Modules: pkg.Modules,
|
||||||
@ -29,16 +32,20 @@ func NewPackage(pkg *Package) *pb.Package {
|
|||||||
Created: timestamppb.New(pkg.Created),
|
Created: timestamppb.New(pkg.Created),
|
||||||
Updated: timestamppb.New(pkg.Updated),
|
Updated: timestamppb.New(pkg.Updated),
|
||||||
}
|
}
|
||||||
|
if pkg.LastCheck.Valid {
|
||||||
|
rsp.LastCheck = timestamppb.New(pkg.LastCheck.Time)
|
||||||
|
}
|
||||||
|
return rsp
|
||||||
}
|
}
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
|
Created time.Time `db:"created"`
|
||||||
|
Updated time.Time `db:"updated"`
|
||||||
Name string `db:"name"`
|
Name string `db:"name"`
|
||||||
Version string `db:"version"`
|
Version string `db:"version"`
|
||||||
LastVersion string `db:"last_version"`
|
LastVersion string `db:"last_version"`
|
||||||
ID uint64 `db:"id"`
|
ID uint64 `db:"id"`
|
||||||
Package uint64 `db:"package"`
|
Package uint64 `db:"package"`
|
||||||
Created time.Time `db:"created" json:"created"`
|
|
||||||
Updated time.Time `db:"updated" json:"updated,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewModule(mod *Module) *pb.Module {
|
func NewModule(mod *Module) *pb.Module {
|
||||||
@ -54,24 +61,24 @@ func NewModule(mod *Module) *pb.Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Issue struct {
|
type Issue struct {
|
||||||
Desc string `db:"desc"`
|
Comment string `db:"comment"`
|
||||||
Modules []int64 `db:"modules"`
|
Modules []int64 `db:"modules"`
|
||||||
ID uint64 `db:"id"`
|
ID uint64 `db:"id"`
|
||||||
Status uint64 `db:"status"`
|
Status uint64 `db:"status"`
|
||||||
Package int64 `db:"package"`
|
Package uint64 `db:"package"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Comment struct {
|
type Comment struct {
|
||||||
Created time.Time `db:"created" json:"created"`
|
Created time.Time `db:"created"`
|
||||||
Updated time.Time `db:"updated" json:"updated,omitempty"`
|
Updated time.Time `db:"updated"`
|
||||||
Text string `db:"value" json:"text"`
|
Comment string `db:"comment"`
|
||||||
ID uint64 `db:"id" json:"id"`
|
ID uint64 `db:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewComment(com *Comment) *pb.Comment {
|
func NewComment(com *Comment) *pb.Comment {
|
||||||
return &pb.Comment{
|
return &pb.Comment{
|
||||||
Id: com.ID,
|
Id: com.ID,
|
||||||
Text: com.Text,
|
Comment: com.Comment,
|
||||||
Created: timestamppb.New(com.Created),
|
Created: timestamppb.New(com.Created),
|
||||||
Updated: timestamppb.New(com.Updated),
|
Updated: timestamppb.New(com.Updated),
|
||||||
}
|
}
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
package client_git
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"database/sql"
|
|
||||||
"embed"
|
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/storage"
|
|
||||||
// "git.unistack.org/unistack-org/pkgdash/internal/storage/postgres"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/storage/sqlite"
|
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestClientPG(t *testing.T) {
|
|
||||||
dsn := fmt.Sprintf("file:///database.db")
|
|
||||||
conn, err := sql.Open("sqlite", dsn)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
if err = conn.Ping(); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
fucntion := sqlite.NewStorage()
|
|
||||||
st := fucntion(conn, embed.FS{})
|
|
||||||
s, ok := st.(storage.Storage)
|
|
||||||
if !ok {
|
|
||||||
t.Fatal("typecast error")
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
_ = cancel
|
|
||||||
cli := NewClient(1)
|
|
||||||
|
|
||||||
ch := cli.Run(ctx, s)
|
|
||||||
|
|
||||||
data := &pb.AddPackageReq{
|
|
||||||
Name: "test",
|
|
||||||
Url: "https://github.com/dantedenis/service_history.git",
|
|
||||||
}
|
|
||||||
|
|
||||||
ch <- data
|
|
||||||
|
|
||||||
<-cli.Done()
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestClientLite(t *testing.T) {
|
|
||||||
conn, err := sql.Open("sqlite3", "../../identifier.sqlite")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
if err = conn.Ping(); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
function := sqlite.NewStorage()
|
|
||||||
st := function(conn, embed.FS{})
|
|
||||||
s, ok := st.(storage.Storage)
|
|
||||||
if !ok {
|
|
||||||
t.Fatal("typecast error")
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
_ = cancel
|
|
||||||
cli := NewClient(1)
|
|
||||||
|
|
||||||
ch := cli.Run(ctx, s)
|
|
||||||
|
|
||||||
data := &pb.AddPackageReq{
|
|
||||||
Name: "test",
|
|
||||||
Url: "https://github.com/dantedenis/service_history.git",
|
|
||||||
}
|
|
||||||
|
|
||||||
ch <- data
|
|
||||||
|
|
||||||
<-cli.Done()
|
|
||||||
}
|
|
@ -1,154 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"database/sql"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
httpsrv "go.unistack.org/micro-server-http/v4" // TODO
|
|
||||||
"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 "git.unistack.org/unistack-org/pkgdash/config"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/handler"
|
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/service/client_git"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/storage"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewService(ctx context.Context) (micro.Service, error) {
|
|
||||||
var reg register.Register
|
|
||||||
|
|
||||||
cfg := intcfg.NewConfig(ServiceName, Service)
|
|
||||||
|
|
||||||
cs := microcfg.NewConfig(config.Struct(cfg))
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
mgsrv := httpsrv.NewServer(
|
|
||||||
options.Register(reg),
|
|
||||||
)
|
|
||||||
|
|
||||||
svc := micro.NewService(
|
|
||||||
micro.Config(cs),
|
|
||||||
)
|
|
||||||
|
|
||||||
h := handler.NewHandler(svc, client_git.NewClient(5))
|
|
||||||
|
|
||||||
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, []config.Config{cs}, config.LoadOverride(true)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := config.Validate(ctx, cfg); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := svc.Init(
|
|
||||||
micro.Name(intcfg.ServiceName),
|
|
||||||
micro.Version(intcfg.ServiceVersion),
|
|
||||||
); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := svc.Server("http").Init(
|
|
||||||
options.Address(cfg.Address),
|
|
||||||
options.Name(cfg.App.Name),
|
|
||||||
server.Version(cfg.App.Version),
|
|
||||||
); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}),
|
|
||||||
micro.BeforeStart(func(_ context.Context) error {
|
|
||||||
log := logger.NewLogger(
|
|
||||||
logger.WithLevel(logger.ParseLevel(cfg.LogLevel)),
|
|
||||||
logger.WithCallerSkipCount(3),
|
|
||||||
)
|
|
||||||
return svc.Init(micro.Logger(log))
|
|
||||||
}),
|
|
||||||
micro.BeforeStart(func(ctx context.Context) error {
|
|
||||||
var connstr string
|
|
||||||
if v, ok := cfg.StorageDSN[cfg.App.Name]; ok {
|
|
||||||
connstr = v
|
|
||||||
} else if v, ok = cfg.StorageDSN["all"]; ok {
|
|
||||||
connstr = v
|
|
||||||
}
|
|
||||||
|
|
||||||
scheme, dsn, err := storageOptions(connstr)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
conn, err := connectDataBase(scheme, dsn)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
store, err := storage.NewStorage(scheme, conn)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ctx = storage.InContext(ctx, store)
|
|
||||||
return svc.Init(micro.Context(ctx))
|
|
||||||
}),
|
|
||||||
); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := pb.RegisterPkgdashServiceServer(mgsrv, h); err != nil {
|
|
||||||
logger.Fatalf(ctx, "failed to register handler: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
intsvc := httpsrv.NewServer(
|
|
||||||
server.Codec("application/json", jsoncodec.NewCodec()),
|
|
||||||
server.Address(cfg.Meter.Addr), server.Context(ctx),
|
|
||||||
)
|
|
||||||
|
|
||||||
if err := intsvc.Init(); err != nil {
|
|
||||||
logger.Fatalf(ctx, "failed to init http srv: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := healthhandler.RegisterHealthServiceServer(intsvc, healthhandler.NewHandler()); err != nil {
|
|
||||||
logger.Fatalf(ctx, "failed to set http handler: %v", err)
|
|
||||||
}
|
|
||||||
if err := meterhandler.RegisterMeterServiceServer(intsvc, meterhandler.NewHandler()); err != nil {
|
|
||||||
logger.Fatalf(ctx, "failed to set http handler: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := intsvc.Start(); err != nil {
|
|
||||||
logger.Fatalf(ctx, "failed to run http srv: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return svc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func storageOptions(dsn string) (string, string, error) {
|
|
||||||
u, err := url.Parse(dsn)
|
|
||||||
if err != nil {
|
|
||||||
return "", "", err
|
|
||||||
}
|
|
||||||
scheme := u.Scheme
|
|
||||||
if idx := strings.Index(u.Scheme, "+"); idx > 0 {
|
|
||||||
scheme = u.Scheme[:idx]
|
|
||||||
u.Scheme = u.Scheme[idx+1:]
|
|
||||||
}
|
|
||||||
return scheme, u.String(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func connectDataBase(driverName, dsn string) (*sql.DB, error) {
|
|
||||||
conn, err := sql.Open(driverName, dsn)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err = conn.Ping(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return conn, err
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
drop table if exists dashboard ;
|
|
||||||
drop table if exists package ;
|
|
||||||
drop table if exists module ;
|
|
||||||
drop table if exists issue ;
|
|
||||||
drop table if exists comment;
|
|
@ -1,39 +0,0 @@
|
|||||||
create table if not exists dashboard (
|
|
||||||
id integer primary key autoincrement not null ,
|
|
||||||
"uuid" uuid not null unique ,
|
|
||||||
package integer[] default '{}'
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists comment (
|
|
||||||
id integer primary key autoincrement not null ,
|
|
||||||
"text" text ,
|
|
||||||
package integer not null,
|
|
||||||
created timestamp not null default current_timestamp ,
|
|
||||||
updated timestamp default current_timestamp
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists module (
|
|
||||||
id integer primary key autoincrement not null ,
|
|
||||||
name varchar not null ,
|
|
||||||
version varchar not null ,
|
|
||||||
last_version varchar not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists issue (
|
|
||||||
id serial not null unique primary key ,
|
|
||||||
--package integer references package(id) ,
|
|
||||||
modules integer[] default '[]',
|
|
||||||
status integer default 0 ,
|
|
||||||
"desc" varchar
|
|
||||||
);
|
|
||||||
|
|
||||||
create table if not exists package (
|
|
||||||
id integer primary key autoincrement not null ,
|
|
||||||
name varchar not null ,
|
|
||||||
url varchar ,
|
|
||||||
modules integer[] default '[]',
|
|
||||||
issues integer[] default '[]',
|
|
||||||
comments integer[] default '[]'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@ -1,34 +1,14 @@
|
|||||||
package sqlite
|
package sqlite
|
||||||
|
|
||||||
const (
|
const (
|
||||||
queryPackagesList = `select
|
queryPackagesProcess = `select id, name, url, comments, modules, issues, created, updated from packages where ROUND((JULIANDAY(CURRENT_TIMESTAMP) - JULIANDAY(last_check)) * 86400) > $1 or last_check is NULL`
|
||||||
id,
|
queryPackagesModulesCount = `update packages set modules = $2, last_check = CURRENT_TIMESTAMP where id = $1;`
|
||||||
name,
|
queryPackagesList = `select id, name, url, comments, modules, issues, created, updated from packages;`
|
||||||
url,
|
queryPackagesLookup = `select id, name, url, comments, modules, issues, created, updated from packages where id = $1;`
|
||||||
comments
|
queryCommentsCreate = `insert into comments (comment) values ($1) returning id;`
|
||||||
modules,
|
queryPackagesCreate = `insert into packages (name, url) values ($1, $2) returning *;`
|
||||||
issues,
|
queryInsMsgGetIDs = `insert into modules(name, version, last_version) values %s returning id;`
|
||||||
from package;
|
queryModulesList = `select id, name, version, last_version, created, updated from modules;`
|
||||||
`
|
queryModulesCreate = `insert into modules (name, version, last_version, package) values ($1, $2, $3, $4) returning *;`
|
||||||
queryCommentsCreate = `
|
queryCommentsList = `select id, text, created, updated from comments;`
|
||||||
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 ;
|
|
||||||
`
|
|
||||||
queryPackagesCreate = `
|
|
||||||
insert into package(name, url, modules) values ($1, $2, $3);
|
|
||||||
`
|
|
||||||
queryInsMsgGetIDs = `
|
|
||||||
insert into module(name, version, last_version) values
|
|
||||||
%s
|
|
||||||
returning id;
|
|
||||||
`
|
|
||||||
queryModulesList = `
|
|
||||||
select id, name, version, last_version, created, updated from modules;
|
|
||||||
`
|
|
||||||
|
|
||||||
queryCommentsList = `
|
|
||||||
select id, text, created, updated from comments;
|
|
||||||
`
|
|
||||||
)
|
)
|
||||||
|
@ -2,130 +2,71 @@ package sqlite
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
|
||||||
"embed"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"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"
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
"go.unistack.org/micro/v4/logger"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
|
"git.unistack.org/unistack-org/pkgdash/internal/storage"
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
|
"go.unistack.org/micro/v4/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
func init() {
|
||||||
pathMigration = `migrations/sqlite`
|
storage.RegisterStorage("sqlite", NewStorage())
|
||||||
)
|
}
|
||||||
|
|
||||||
|
var _ storage.Storage = (*Sqlite)(nil)
|
||||||
|
|
||||||
type Sqlite struct {
|
type Sqlite struct {
|
||||||
db *sql.DB
|
db *sqlx.DB
|
||||||
fs embed.FS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStorage() func(*sql.DB, embed.FS) interface{} {
|
func NewStorage() func(*sqlx.DB) interface{} {
|
||||||
return func(db *sql.DB, fs embed.FS) interface{} {
|
return func(db *sqlx.DB) interface{} {
|
||||||
return &Sqlite{db: db, fs: fs}
|
return &Sqlite{db: db}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sqlite) MigrateUp() error {
|
func (s *Sqlite) PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq) error {
|
||||||
driver, err := sqlite.WithInstance(s.db, &sqlite.Config{
|
return fmt.Errorf("need implement")
|
||||||
MigrationsTable: sqlite.DefaultMigrationsTable,
|
|
||||||
DatabaseName: "pkgdash",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
source, err := iofs.New(s.fs, pathMigration)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: pass own logger
|
|
||||||
m, err := migrate.NewWithInstance("fs", source, "pkgdash", driver)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = m.Up(); err != nil && !errors.Is(err, migrate.ErrNoChange) {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sqlite) MigrateDown() error {
|
func (s *Sqlite) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq) (*models.Package, error) {
|
||||||
driver, err := sqlite.WithInstance(s.db, &sqlite.Config{
|
return nil, fmt.Errorf("need implement")
|
||||||
MigrationsTable: sqlite.DefaultMigrationsTable,
|
|
||||||
DatabaseName: "pkgdash",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
source, err := iofs.New(s.fs, pathMigration)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: pass own logger
|
|
||||||
m, err := migrate.NewWithInstance("fs", source, "pkgdash", driver)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = m.Down(); err != nil && !errors.Is(err, migrate.ErrNoChange) {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sqlite) PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq) error {
|
func (s *Sqlite) PackagesLookup(ctx context.Context, req *pb.PackagesLookupReq) (*models.Package, error) {
|
||||||
panic("need implement")
|
pkg := &models.Package{}
|
||||||
|
|
||||||
|
err := s.db.GetContext(ctx, pkg, queryPackagesLookup, req.Id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkg, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sqlite) PackagesList(ctx context.Context, req *pb.PackagesListReq) ([]*models.Package, error) {
|
func (s *Sqlite) PackagesList(ctx context.Context, req *pb.PackagesListReq) ([]*models.Package, error) {
|
||||||
var packages []*models.Package
|
var packages []*models.Package
|
||||||
|
|
||||||
rows, err := s.db.QueryContext(ctx, queryPackagesList)
|
err := s.db.SelectContext(ctx, &packages, queryPackagesList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for ; rows.Err() == nil; rows.Next() {
|
return packages, nil
|
||||||
pkg := &models.Package{}
|
|
||||||
if err = rows.Scan(
|
|
||||||
&pkg.ID,
|
|
||||||
&pkg.Name,
|
|
||||||
&pkg.URL,
|
|
||||||
&pkg.Comments,
|
|
||||||
); err != nil {
|
|
||||||
_ = rows.Close()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
packages = append(packages, pkg)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = rows.Err(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = rows.Close(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return packages, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sqlite) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq) (id uint64, err error) {
|
func (s *Sqlite) CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Sqlite) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq) (*models.Comment, error) {
|
||||||
tx, err := s.db.BeginTx(ctx, nil)
|
tx, err := s.db.BeginTx(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -138,85 +79,61 @@ func (s *Sqlite) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq)
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err = tx.QueryRowContext(ctx, queryCommentsCreate, req.Text, req.PackageId).Scan(&id); err != nil {
|
if _, err = tx.ExecContext(ctx, queryCommentsCreate, req.Comment, req.PackageId); err != nil {
|
||||||
return id, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return id, err
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sqlite) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq) error {
|
func (s *Sqlite) PackagesProcess(ctx context.Context, td time.Duration) ([]*models.Package, error) {
|
||||||
tx, err := s.db.BeginTx(ctx, nil)
|
var packages []*models.Package
|
||||||
|
err := s.db.SelectContext(ctx, &packages, queryPackagesProcess, td.Seconds())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return packages, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Sqlite) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq) (*models.Package, error) {
|
||||||
|
pkg := &models.Package{}
|
||||||
|
err := s.db.GetContext(ctx, pkg, queryPackagesCreate, req.Name, req.Url)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkg, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Sqlite) PackagesModulesCreate(ctx context.Context, pkg *models.Package, modules []*models.Module) error {
|
||||||
|
tx, err := s.db.BeginTxx(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
for _, mod := range modules {
|
||||||
|
err = tx.GetContext(ctx, mod, queryModulesCreate, mod.Name, mod.Version, mod.LastVersion, mod.Package)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
_ = tx.Rollback()
|
||||||
logger.Errorf(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
|
return err
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = tx.Commit()
|
|
||||||
}
|
}
|
||||||
}()
|
}
|
||||||
|
|
||||||
res, err := tx.ExecContext(ctx, queryPackagesCreate, req.Name, req.Url, pq.Array(req.Modules))
|
if _, err = tx.ExecContext(ctx, queryPackagesModulesCount, pkg.ID, len(modules)); err != nil {
|
||||||
if err != nil {
|
_ = tx.Rollback()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if aff, affErr := res.RowsAffected(); err != nil {
|
if err = tx.Commit(); err != nil {
|
||||||
err = affErr
|
_ = tx.Rollback()
|
||||||
} else if aff == 0 {
|
return err
|
||||||
err = errors.New("rows affected is 0")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sqlite) InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error) {
|
func (s *Sqlite) ModulesList(ctx context.Context, req *pb.ModulesListReq) ([]*models.Module, error) {
|
||||||
tx, err := s.db.BeginTx(ctx, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
|
||||||
logger.Errorf(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = tx.Commit()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
query := generateQuery(req)
|
|
||||||
|
|
||||||
rows, err := tx.QueryContext(ctx, query)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err = rows.Close(); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = rows.Err()
|
|
||||||
}()
|
|
||||||
|
|
||||||
result := make([]uint64, 0)
|
|
||||||
for rows.Next() {
|
|
||||||
tmp := uint64(0)
|
|
||||||
if err = rows.Scan(&tmp); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
result = append(result, tmp)
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Sqlite) GetModule(ctx context.Context, req *pb.ModulesListReq) ([]*models.Module, error) {
|
|
||||||
var err error
|
var err error
|
||||||
var modules []*models.Module
|
var modules []*models.Module
|
||||||
|
|
||||||
@ -259,50 +176,14 @@ func (s *Sqlite) GetModule(ctx context.Context, req *pb.ModulesListReq) ([]*mode
|
|||||||
func (s *Sqlite) CommentsList(ctx context.Context, req *pb.CommentsListReq) ([]*models.Comment, error) {
|
func (s *Sqlite) CommentsList(ctx context.Context, req *pb.CommentsListReq) ([]*models.Comment, error) {
|
||||||
var comments []*models.Comment
|
var comments []*models.Comment
|
||||||
|
|
||||||
rows, err := s.db.QueryContext(ctx, queryCommentsList, req.PackageId)
|
err := s.db.SelectContext(ctx, &comments, queryCommentsList, req.PackageId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func() {
|
|
||||||
if err = rows.Close(); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = rows.Err()
|
|
||||||
}()
|
|
||||||
for ; rows.Err() == nil; rows.Next() {
|
|
||||||
com := &models.Comment{}
|
|
||||||
if err = rows.Scan(
|
|
||||||
&com.ID,
|
|
||||||
&com.Text,
|
|
||||||
&com.Created,
|
|
||||||
&com.Updated,
|
|
||||||
); err != nil {
|
|
||||||
_ = rows.Close()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
comments = append(comments, com)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = rows.Err(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = rows.Close(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return comments, nil
|
return comments, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertSliceUInt(arg ...uint64) []interface{} {
|
|
||||||
result := make([]interface{}, 0, len(arg))
|
|
||||||
for i := range arg {
|
|
||||||
result = append(result, arg[i])
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func generateQuery(rsp []models.Module) string {
|
func generateQuery(rsp []models.Module) string {
|
||||||
const pattern = `%c('%s', '%s', '%s')`
|
const pattern = `%c('%s', '%s', '%s')`
|
||||||
build := strings.Builder{}
|
build := strings.Builder{}
|
||||||
@ -315,7 +196,3 @@ func generateQuery(rsp []models.Module) string {
|
|||||||
|
|
||||||
return fmt.Sprintf(queryInsMsgGetIDs, build.String())
|
return fmt.Sprintf(queryInsMsgGetIDs, build.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateArrayIneq(count int) string {
|
|
||||||
return "(?" + strings.Repeat(",?", count-1) + ")"
|
|
||||||
}
|
|
||||||
|
@ -2,68 +2,43 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
|
||||||
"embed"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
// "git.unistack.org/unistack-org/pkgdash/internal/storage/postgres"
|
|
||||||
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/storage/sqlite"
|
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed migrations
|
func RegisterStorage(name string, fn func(*sqlx.DB) interface{}) {
|
||||||
var fs embed.FS
|
storages[name] = fn
|
||||||
|
|
||||||
var storages = map[string]func(*sql.DB, embed.FS) interface{}{
|
|
||||||
//"postgres": postgres.NewStorage(),
|
|
||||||
"sqlite": sqlite.NewStorage(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type contextKey string
|
var storages = map[string]func(*sqlx.DB) interface{}{}
|
||||||
|
|
||||||
var storeIdent = contextKey("store")
|
|
||||||
|
|
||||||
type Migrate interface {
|
|
||||||
MigrateUp() error
|
|
||||||
MigrateDown() error
|
|
||||||
}
|
|
||||||
|
|
||||||
type Storage interface {
|
type Storage interface {
|
||||||
Migrate
|
PackagesProcess(ctx context.Context, td time.Duration) ([]*models.Package, error)
|
||||||
PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq) error
|
PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq) (*models.Package, error)
|
||||||
PackagesList(ctx context.Context, req *pb.PackagesListReq) ([]*models.Package, error)
|
PackagesList(ctx context.Context, req *pb.PackagesListReq) ([]*models.Package, error)
|
||||||
PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq) error
|
PackagesLookup(ctx context.Context, req *pb.PackagesLookupReq) (*models.Package, error)
|
||||||
|
PackagesUpdate(ctx context.Context, req *pb.PackagesUpdateReq) (*models.Package, error)
|
||||||
PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq) error
|
PackagesDelete(ctx context.Context, req *pb.PackagesDeleteReq) error
|
||||||
CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq) (*models.Comment, error)
|
CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq) (*models.Comment, error)
|
||||||
CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq) error
|
CommentsDelete(ctx context.Context, req *pb.CommentsDeleteReq) error
|
||||||
CommentsList(ctx context.Context, req *pb.CommentsListReq) ([]*models.Comment, error)
|
CommentsList(ctx context.Context, req *pb.CommentsListReq) ([]*models.Comment, error)
|
||||||
InsertButchModules(ctx context.Context, req []models.Module) ([]uint64, error)
|
|
||||||
ModulesList(ctx context.Context, req *pb.ModulesListReq) ([]*models.Module, error)
|
ModulesList(ctx context.Context, req *pb.ModulesListReq) ([]*models.Module, error)
|
||||||
|
PackagesModulesCreate(ctx context.Context, pkg *models.Package, modules []*models.Module) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStorage(name string, db *sql.DB) (Storage, error) {
|
func NewStorage(name string, db *sqlx.DB) (Storage, error) {
|
||||||
function, ok := storages[name]
|
function, ok := storages[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("incorrect name store")
|
return nil, errors.New("incorrect name store")
|
||||||
}
|
}
|
||||||
store := function(db, fs)
|
store := function(db)
|
||||||
database, ok := store.(Storage)
|
database, ok := store.(Storage)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("dont implements interface Storage")
|
return nil, errors.New("dont implements interface Storage")
|
||||||
}
|
}
|
||||||
return database, nil
|
return database, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func InContext(ctx context.Context, val Storage) context.Context {
|
|
||||||
return context.WithValue(ctx, storeIdent, val)
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromContext(ctx context.Context) (Storage, error) {
|
|
||||||
if store, ok := ctx.Value(storeIdent).(Storage); !ok {
|
|
||||||
return nil, errors.New("empty store")
|
|
||||||
} else {
|
|
||||||
return store, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,96 +1,76 @@
|
|||||||
package client_git
|
package worker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.unistack.org/unistack-org/pkgdash/internal"
|
||||||
|
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||||
|
"git.unistack.org/unistack-org/pkgdash/internal/storage"
|
||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
"github.com/go-git/go-git/v5/plumbing/filemode"
|
"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/plumbing/object"
|
||||||
"github.com/go-git/go-git/v5/storage/memory"
|
"github.com/go-git/go-git/v5/storage/memory"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"go.unistack.org/micro/v4/logger"
|
"go.unistack.org/micro/v4/logger"
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
|
||||||
"git.unistack.org/unistack-org/pkgdash/internal/storage"
|
|
||||||
pb "git.unistack.org/unistack-org/pkgdash/proto"
|
|
||||||
"golang.org/x/mod/modfile"
|
"golang.org/x/mod/modfile"
|
||||||
"golang.org/x/mod/module"
|
"golang.org/x/mod/module"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client interface {
|
func Run(ctx context.Context, store storage.Storage, td time.Duration) {
|
||||||
Run(ctx context.Context, st storage.Storage) chan *pb.PackagesCreateReq
|
ticker := time.NewTicker(5 * time.Second)
|
||||||
IsClose() bool
|
defer ticker.Stop()
|
||||||
Done() <-chan struct{}
|
var wg sync.WaitGroup
|
||||||
}
|
for {
|
||||||
|
select {
|
||||||
type client struct {
|
case <-ctx.Done():
|
||||||
worker chan *pb.PackagesCreateReq
|
return
|
||||||
closed bool
|
case <-ticker.C:
|
||||||
lock chan struct{}
|
logger.Infof(ctx, "check packages to process")
|
||||||
}
|
packages, err := store.PackagesProcess(ctx, td)
|
||||||
|
logger.Infof(ctx, "check packages to process %#+v, err: %v", packages, err)
|
||||||
func NewClient(cap uint) Client {
|
if err != nil && err != sql.ErrNoRows {
|
||||||
return &client{
|
logger.Fatalf(ctx, "failed to get packages to process: %v", err)
|
||||||
make(chan *pb.PackagesCreateReq, cap),
|
|
||||||
false,
|
|
||||||
make(chan struct{}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) Run(ctx context.Context, st storage.Storage) chan *pb.PackagesCreateReq {
|
|
||||||
go func() {
|
|
||||||
defer close(c.worker)
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case data := <-c.worker:
|
|
||||||
go func() {
|
|
||||||
runner(ctx, st, data)
|
|
||||||
}()
|
|
||||||
case <-ctx.Done():
|
|
||||||
logger.Info(ctx, ctx.Err())
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
wg.Add(len(packages))
|
||||||
|
for _, pkg := range packages {
|
||||||
|
go func(p *models.Package) {
|
||||||
|
if err := process(ctx, store, p); err != nil {
|
||||||
|
logger.Errorf(ctx, "failed to process package %s: %v", p.Name, err)
|
||||||
|
}
|
||||||
|
wg.Done()
|
||||||
|
}(pkg)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
}
|
}
|
||||||
}()
|
}
|
||||||
|
|
||||||
return c.worker
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) IsClose() bool {
|
func process(ctx context.Context, store storage.Storage, pkg *models.Package) error {
|
||||||
return c.closed
|
logger.Infof(ctx, "process package %v", pkg)
|
||||||
}
|
modules, err := getGoModule(ctx, pkg.ID, pkg.URL)
|
||||||
|
|
||||||
// Done for locked goroutine
|
|
||||||
func (c *client) Done() <-chan struct{} {
|
|
||||||
return c.lock
|
|
||||||
}
|
|
||||||
|
|
||||||
func runner(ctx context.Context, st storage.Storage, req *pb.PackagesCreateReq) {
|
|
||||||
modules, err := getGoModule(ctx, req.Url)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(ctx, err)
|
logger.Errorf(ctx, "failed to get modules: %v", err)
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Infof(ctx, "success get list mod", modules)
|
if err = store.PackagesModulesCreate(ctx, pkg, modules); err != nil {
|
||||||
|
logger.Errorf(ctx, "failed to set create modules: %v", err)
|
||||||
if req.Modules, err = st.InsertButchModules(ctx, modules); err != nil {
|
return err
|
||||||
logger.Error(ctx, err)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = st.PackagesCreate(ctx, req); err != nil {
|
return nil
|
||||||
logger.Error(ctx, err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getGoModule(ctx context.Context, gitUrl string) ([]models.Module, error) {
|
func getGoModule(ctx context.Context, pkgID uint64, gitUrl string) ([]*models.Module, error) {
|
||||||
u, err := url.Parse(gitUrl)
|
u, err := url.Parse(gitUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(ctx, err)
|
logger.Fatal(ctx, err)
|
||||||
@ -135,7 +115,7 @@ func getGoModule(ctx context.Context, gitUrl string) ([]models.Module, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
unique := make(map[string]models.Module)
|
unique := make(map[string]*models.Module)
|
||||||
var mvs []module.Version
|
var mvs []module.Version
|
||||||
err = tree.Files().ForEach(func(file *object.File) error {
|
err = tree.Files().ForEach(func(file *object.File) error {
|
||||||
if file == nil {
|
if file == nil {
|
||||||
@ -151,7 +131,8 @@ func getGoModule(ctx context.Context, gitUrl string) ([]models.Module, error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for i := range mvs {
|
for i := range mvs {
|
||||||
unique[mvs[i].Path] = models.Module{
|
unique[mvs[i].Path] = &models.Module{
|
||||||
|
Package: pkgID,
|
||||||
Name: mvs[i].Path,
|
Name: mvs[i].Path,
|
||||||
Version: mvs[i].Version,
|
Version: mvs[i].Version,
|
||||||
LastVersion: mvs[i].Version,
|
LastVersion: mvs[i].Version,
|
||||||
@ -177,7 +158,7 @@ func getGoModule(ctx context.Context, gitUrl string) ([]models.Module, error) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
result := make([]models.Module, 0, len(unique))
|
result := make([]*models.Module, 0, len(unique))
|
||||||
for _, v := range unique {
|
for _, v := range unique {
|
||||||
result = append(result, v)
|
result = append(result, v)
|
||||||
}
|
}
|
8
local.yaml
Normal file
8
local.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
server:
|
||||||
|
addr: ":9091"
|
||||||
|
logger_level: "debug"
|
||||||
|
meter:
|
||||||
|
addr: ":8081"
|
||||||
|
path: "/metrics"
|
||||||
|
database:
|
||||||
|
dsn: "sqlite://./database.db?migrate=up"
|
@ -95,6 +95,30 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PackagesCreateRsp'
|
$ref: '#/components/schemas/PackagesCreateRsp'
|
||||||
/v1/packages/{id}:
|
/v1/packages/{id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- PkgdashService
|
||||||
|
operationId: PackagesLookup
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: uint64
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: Default
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ErrorRsp'
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/PackagesLookupRsp'
|
||||||
put:
|
put:
|
||||||
tags:
|
tags:
|
||||||
- PkgdashService
|
- PkgdashService
|
||||||
@ -149,6 +173,31 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PackagesDeleteRsp'
|
$ref: '#/components/schemas/PackagesDeleteRsp'
|
||||||
|
/v1/packages/{id}/modules:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- PkgdashService
|
||||||
|
operationId: PackagesModules
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: uint64
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: Default
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ErrorRsp'
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/PackagesModulesRsp'
|
||||||
/v1/packages/{package_id}/comments:
|
/v1/packages/{package_id}/comments:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@ -246,7 +295,7 @@ components:
|
|||||||
package:
|
package:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: uint64
|
||||||
text:
|
comment:
|
||||||
type: string
|
type: string
|
||||||
created:
|
created:
|
||||||
type: string
|
type: string
|
||||||
@ -260,7 +309,7 @@ components:
|
|||||||
package_id:
|
package_id:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: uint64
|
||||||
text:
|
comment:
|
||||||
type: string
|
type: string
|
||||||
CommentsCreateRsp:
|
CommentsCreateRsp:
|
||||||
type: object
|
type: object
|
||||||
@ -332,26 +381,23 @@ components:
|
|||||||
url:
|
url:
|
||||||
type: string
|
type: string
|
||||||
modules:
|
modules:
|
||||||
type: array
|
type: integer
|
||||||
items:
|
format: uint64
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
issues:
|
issues:
|
||||||
type: array
|
type: integer
|
||||||
items:
|
format: uint64
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
comments:
|
comments:
|
||||||
type: array
|
type: integer
|
||||||
items:
|
format: uint64
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
created:
|
created:
|
||||||
type: string
|
type: string
|
||||||
format: RFC3339
|
format: RFC3339
|
||||||
updated:
|
updated:
|
||||||
type: string
|
type: string
|
||||||
format: RFC3339
|
format: RFC3339
|
||||||
|
last_check:
|
||||||
|
type: string
|
||||||
|
format: RFC3339
|
||||||
PackagesCreateReq:
|
PackagesCreateReq:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@ -367,8 +413,8 @@ components:
|
|||||||
PackagesCreateRsp:
|
PackagesCreateRsp:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
status:
|
package:
|
||||||
type: string
|
$ref: '#/components/schemas/Package'
|
||||||
PackagesDeleteRsp:
|
PackagesDeleteRsp:
|
||||||
type: object
|
type: object
|
||||||
properties: {}
|
properties: {}
|
||||||
@ -379,6 +425,18 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Package'
|
$ref: '#/components/schemas/Package'
|
||||||
|
PackagesLookupRsp:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
package:
|
||||||
|
$ref: '#/components/schemas/Package'
|
||||||
|
PackagesModulesRsp:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
modules:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Module'
|
||||||
PackagesUpdateReq:
|
PackagesUpdateReq:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
1103
proto/pkgdash.pb.go
1103
proto/pkgdash.pb.go
File diff suppressed because it is too large
Load Diff
@ -35,6 +35,477 @@ var (
|
|||||||
_ = sort.Sort
|
_ = sort.Sort
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Validate checks the field values on PackagesModulesReq 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 *PackagesModulesReq) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on PackagesModulesReq 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
|
||||||
|
// PackagesModulesReqMultiError, or nil if none found.
|
||||||
|
func (m *PackagesModulesReq) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PackagesModulesReq) validate(all bool) error {
|
||||||
|
if m == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
|
// no validation rules for Id
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return PackagesModulesReqMultiError(errors)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackagesModulesReqMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by PackagesModulesReq.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type PackagesModulesReqMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m PackagesModulesReqMultiError) 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 PackagesModulesReqMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
|
// PackagesModulesReqValidationError is the validation error returned by
|
||||||
|
// PackagesModulesReq.Validate if the designated constraints aren't met.
|
||||||
|
type PackagesModulesReqValidationError struct {
|
||||||
|
field string
|
||||||
|
reason string
|
||||||
|
cause error
|
||||||
|
key bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Field function returns field value.
|
||||||
|
func (e PackagesModulesReqValidationError) Field() string { return e.field }
|
||||||
|
|
||||||
|
// Reason function returns reason value.
|
||||||
|
func (e PackagesModulesReqValidationError) Reason() string { return e.reason }
|
||||||
|
|
||||||
|
// Cause function returns cause value.
|
||||||
|
func (e PackagesModulesReqValidationError) Cause() error { return e.cause }
|
||||||
|
|
||||||
|
// Key function returns key value.
|
||||||
|
func (e PackagesModulesReqValidationError) Key() bool { return e.key }
|
||||||
|
|
||||||
|
// ErrorName returns error name.
|
||||||
|
func (e PackagesModulesReqValidationError) ErrorName() string {
|
||||||
|
return "PackagesModulesReqValidationError"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error satisfies the builtin error interface
|
||||||
|
func (e PackagesModulesReqValidationError) 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 %sPackagesModulesReq.%s: %s%s",
|
||||||
|
key,
|
||||||
|
e.field,
|
||||||
|
e.reason,
|
||||||
|
cause)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ error = PackagesModulesReqValidationError{}
|
||||||
|
|
||||||
|
var _ interface {
|
||||||
|
Field() string
|
||||||
|
Reason() string
|
||||||
|
Key() bool
|
||||||
|
Cause() error
|
||||||
|
ErrorName() string
|
||||||
|
} = PackagesModulesReqValidationError{}
|
||||||
|
|
||||||
|
// Validate checks the field values on PackagesModulesRsp 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 *PackagesModulesRsp) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on PackagesModulesRsp 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
|
||||||
|
// PackagesModulesRspMultiError, or nil if none found.
|
||||||
|
func (m *PackagesModulesRsp) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PackagesModulesRsp) validate(all bool) error {
|
||||||
|
if m == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
|
for idx, item := range m.GetModules() {
|
||||||
|
_, _ = idx, item
|
||||||
|
|
||||||
|
if all {
|
||||||
|
switch v := interface{}(item).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, PackagesModulesRspValidationError{
|
||||||
|
field: fmt.Sprintf("Modules[%v]", idx),
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, PackagesModulesRspValidationError{
|
||||||
|
field: fmt.Sprintf("Modules[%v]", idx),
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
return PackagesModulesRspValidationError{
|
||||||
|
field: fmt.Sprintf("Modules[%v]", idx),
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return PackagesModulesRspMultiError(errors)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackagesModulesRspMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by PackagesModulesRsp.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type PackagesModulesRspMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m PackagesModulesRspMultiError) 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 PackagesModulesRspMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
|
// PackagesModulesRspValidationError is the validation error returned by
|
||||||
|
// PackagesModulesRsp.Validate if the designated constraints aren't met.
|
||||||
|
type PackagesModulesRspValidationError struct {
|
||||||
|
field string
|
||||||
|
reason string
|
||||||
|
cause error
|
||||||
|
key bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Field function returns field value.
|
||||||
|
func (e PackagesModulesRspValidationError) Field() string { return e.field }
|
||||||
|
|
||||||
|
// Reason function returns reason value.
|
||||||
|
func (e PackagesModulesRspValidationError) Reason() string { return e.reason }
|
||||||
|
|
||||||
|
// Cause function returns cause value.
|
||||||
|
func (e PackagesModulesRspValidationError) Cause() error { return e.cause }
|
||||||
|
|
||||||
|
// Key function returns key value.
|
||||||
|
func (e PackagesModulesRspValidationError) Key() bool { return e.key }
|
||||||
|
|
||||||
|
// ErrorName returns error name.
|
||||||
|
func (e PackagesModulesRspValidationError) ErrorName() string {
|
||||||
|
return "PackagesModulesRspValidationError"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error satisfies the builtin error interface
|
||||||
|
func (e PackagesModulesRspValidationError) 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 %sPackagesModulesRsp.%s: %s%s",
|
||||||
|
key,
|
||||||
|
e.field,
|
||||||
|
e.reason,
|
||||||
|
cause)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ error = PackagesModulesRspValidationError{}
|
||||||
|
|
||||||
|
var _ interface {
|
||||||
|
Field() string
|
||||||
|
Reason() string
|
||||||
|
Key() bool
|
||||||
|
Cause() error
|
||||||
|
ErrorName() string
|
||||||
|
} = PackagesModulesRspValidationError{}
|
||||||
|
|
||||||
|
// Validate checks the field values on PackagesLookupReq 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 *PackagesLookupReq) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on PackagesLookupReq 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
|
||||||
|
// PackagesLookupReqMultiError, or nil if none found.
|
||||||
|
func (m *PackagesLookupReq) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PackagesLookupReq) validate(all bool) error {
|
||||||
|
if m == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
|
// no validation rules for Id
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return PackagesLookupReqMultiError(errors)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackagesLookupReqMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by PackagesLookupReq.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type PackagesLookupReqMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m PackagesLookupReqMultiError) 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 PackagesLookupReqMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
|
// PackagesLookupReqValidationError is the validation error returned by
|
||||||
|
// PackagesLookupReq.Validate if the designated constraints aren't met.
|
||||||
|
type PackagesLookupReqValidationError struct {
|
||||||
|
field string
|
||||||
|
reason string
|
||||||
|
cause error
|
||||||
|
key bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Field function returns field value.
|
||||||
|
func (e PackagesLookupReqValidationError) Field() string { return e.field }
|
||||||
|
|
||||||
|
// Reason function returns reason value.
|
||||||
|
func (e PackagesLookupReqValidationError) Reason() string { return e.reason }
|
||||||
|
|
||||||
|
// Cause function returns cause value.
|
||||||
|
func (e PackagesLookupReqValidationError) Cause() error { return e.cause }
|
||||||
|
|
||||||
|
// Key function returns key value.
|
||||||
|
func (e PackagesLookupReqValidationError) Key() bool { return e.key }
|
||||||
|
|
||||||
|
// ErrorName returns error name.
|
||||||
|
func (e PackagesLookupReqValidationError) ErrorName() string {
|
||||||
|
return "PackagesLookupReqValidationError"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error satisfies the builtin error interface
|
||||||
|
func (e PackagesLookupReqValidationError) 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 %sPackagesLookupReq.%s: %s%s",
|
||||||
|
key,
|
||||||
|
e.field,
|
||||||
|
e.reason,
|
||||||
|
cause)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ error = PackagesLookupReqValidationError{}
|
||||||
|
|
||||||
|
var _ interface {
|
||||||
|
Field() string
|
||||||
|
Reason() string
|
||||||
|
Key() bool
|
||||||
|
Cause() error
|
||||||
|
ErrorName() string
|
||||||
|
} = PackagesLookupReqValidationError{}
|
||||||
|
|
||||||
|
// Validate checks the field values on PackagesLookupRsp 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 *PackagesLookupRsp) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on PackagesLookupRsp 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
|
||||||
|
// PackagesLookupRspMultiError, or nil if none found.
|
||||||
|
func (m *PackagesLookupRsp) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PackagesLookupRsp) validate(all bool) error {
|
||||||
|
if m == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
|
if all {
|
||||||
|
switch v := interface{}(m.GetPackage()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, PackagesLookupRspValidationError{
|
||||||
|
field: "Package",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, PackagesLookupRspValidationError{
|
||||||
|
field: "Package",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetPackage()).(interface{ Validate() error }); ok {
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
return PackagesLookupRspValidationError{
|
||||||
|
field: "Package",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return PackagesLookupRspMultiError(errors)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackagesLookupRspMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by PackagesLookupRsp.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type PackagesLookupRspMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m PackagesLookupRspMultiError) 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 PackagesLookupRspMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
|
// PackagesLookupRspValidationError is the validation error returned by
|
||||||
|
// PackagesLookupRsp.Validate if the designated constraints aren't met.
|
||||||
|
type PackagesLookupRspValidationError struct {
|
||||||
|
field string
|
||||||
|
reason string
|
||||||
|
cause error
|
||||||
|
key bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Field function returns field value.
|
||||||
|
func (e PackagesLookupRspValidationError) Field() string { return e.field }
|
||||||
|
|
||||||
|
// Reason function returns reason value.
|
||||||
|
func (e PackagesLookupRspValidationError) Reason() string { return e.reason }
|
||||||
|
|
||||||
|
// Cause function returns cause value.
|
||||||
|
func (e PackagesLookupRspValidationError) Cause() error { return e.cause }
|
||||||
|
|
||||||
|
// Key function returns key value.
|
||||||
|
func (e PackagesLookupRspValidationError) Key() bool { return e.key }
|
||||||
|
|
||||||
|
// ErrorName returns error name.
|
||||||
|
func (e PackagesLookupRspValidationError) ErrorName() string {
|
||||||
|
return "PackagesLookupRspValidationError"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error satisfies the builtin error interface
|
||||||
|
func (e PackagesLookupRspValidationError) 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 %sPackagesLookupRsp.%s: %s%s",
|
||||||
|
key,
|
||||||
|
e.field,
|
||||||
|
e.reason,
|
||||||
|
cause)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ error = PackagesLookupRspValidationError{}
|
||||||
|
|
||||||
|
var _ interface {
|
||||||
|
Field() string
|
||||||
|
Reason() string
|
||||||
|
Key() bool
|
||||||
|
Cause() error
|
||||||
|
ErrorName() string
|
||||||
|
} = PackagesLookupRspValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on ErrorRsp with the rules defined in the
|
// Validate checks the field values on ErrorRsp with the rules defined in the
|
||||||
// proto definition for this message. If any rules are violated, the first
|
// proto definition for this message. If any rules are violated, the first
|
||||||
// error encountered is returned, or nil if there are no violations.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
@ -195,6 +666,12 @@ func (m *Package) validate(all bool) error {
|
|||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no validation rules for Modules
|
||||||
|
|
||||||
|
// no validation rules for Issues
|
||||||
|
|
||||||
|
// no validation rules for Comments
|
||||||
|
|
||||||
if all {
|
if all {
|
||||||
switch v := interface{}(m.GetCreated()).(type) {
|
switch v := interface{}(m.GetCreated()).(type) {
|
||||||
case interface{ ValidateAll() error }:
|
case interface{ ValidateAll() error }:
|
||||||
@ -253,6 +730,35 @@ func (m *Package) validate(all bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if all {
|
||||||
|
switch v := interface{}(m.GetLastCheck()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, PackageValidationError{
|
||||||
|
field: "LastCheck",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, PackageValidationError{
|
||||||
|
field: "LastCheck",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetLastCheck()).(interface{ Validate() error }); ok {
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
return PackageValidationError{
|
||||||
|
field: "LastCheck",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
return PackageMultiError(errors)
|
return PackageMultiError(errors)
|
||||||
}
|
}
|
||||||
@ -781,7 +1287,7 @@ func (m *Comment) validate(all bool) error {
|
|||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// no validation rules for Text
|
// no validation rules for Comment
|
||||||
|
|
||||||
if all {
|
if all {
|
||||||
switch v := interface{}(m.GetCreated()).(type) {
|
switch v := interface{}(m.GetCreated()).(type) {
|
||||||
@ -1856,7 +2362,7 @@ func (m *CommentsCreateReq) validate(all bool) error {
|
|||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// no validation rules for Text
|
// no validation rules for Comment
|
||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
return CommentsCreateReqMultiError(errors)
|
return CommentsCreateReqMultiError(errors)
|
||||||
@ -2212,15 +2718,33 @@ func (m *PackagesCreateRsp) validate(all bool) error {
|
|||||||
|
|
||||||
var errors []error
|
var errors []error
|
||||||
|
|
||||||
if utf8.RuneCountInString(m.GetStatus()) < 1 {
|
if all {
|
||||||
err := PackagesCreateRspValidationError{
|
switch v := interface{}(m.GetPackage()).(type) {
|
||||||
field: "Status",
|
case interface{ ValidateAll() error }:
|
||||||
reason: "value length must be at least 1 runes",
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, PackagesCreateRspValidationError{
|
||||||
|
field: "Package",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, PackagesCreateRspValidationError{
|
||||||
|
field: "Package",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if !all {
|
} else if v, ok := interface{}(m.GetPackage()).(interface{ Validate() error }); ok {
|
||||||
return err
|
if err := v.Validate(); err != nil {
|
||||||
|
return PackagesCreateRspValidationError{
|
||||||
|
field: "Package",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
errors = append(errors, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
|
@ -3,13 +3,26 @@ syntax = "proto3";
|
|||||||
package pkgdash;
|
package pkgdash;
|
||||||
|
|
||||||
import "api/annotations.proto";
|
import "api/annotations.proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
import "openapiv3/annotations.proto";
|
import "openapiv3/annotations.proto";
|
||||||
import "validate/validate.proto";
|
import "validate/validate.proto";
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
|
|
||||||
option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb";
|
option go_package = "go.unistack.org/unistack-org/pkgdash/proto;pkgdashpb";
|
||||||
|
|
||||||
service PkgdashService {
|
service PkgdashService {
|
||||||
|
rpc PackagesLookup(PackagesLookupReq) returns (PackagesLookupRsp) {
|
||||||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||||||
|
operation_id: "PackagesLookup";
|
||||||
|
responses: {
|
||||||
|
default: {
|
||||||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
option (micro.api.http) = {
|
||||||
|
get: "/v1/packages/{id}";
|
||||||
|
};
|
||||||
|
}
|
||||||
rpc PackagesCreate(PackagesCreateReq) returns (PackagesCreateRsp) {
|
rpc PackagesCreate(PackagesCreateReq) returns (PackagesCreateRsp) {
|
||||||
option (micro.openapiv3.openapiv3_operation) = {
|
option (micro.openapiv3.openapiv3_operation) = {
|
||||||
operation_id: "PackagesCreate";
|
operation_id: "PackagesCreate";
|
||||||
@ -46,6 +59,17 @@ service PkgdashService {
|
|||||||
};
|
};
|
||||||
option (micro.api.http) = {get: "/v1/packages"};
|
option (micro.api.http) = {get: "/v1/packages"};
|
||||||
}
|
}
|
||||||
|
rpc PackagesModules(PackagesModulesReq) returns (PackagesModulesRsp) {
|
||||||
|
option (micro.openapiv3.openapiv3_operation) = {
|
||||||
|
operation_id: "PackagesModules";
|
||||||
|
responses: {
|
||||||
|
default: {
|
||||||
|
reference: {_ref: ".pkgdash.ErrorRsp"};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
option (micro.api.http) = {get: "/v1/packages/{id}/modules"};
|
||||||
|
}
|
||||||
rpc PackagesUpdate(PackagesUpdateReq) returns (PackagesUpdateRsp) {
|
rpc PackagesUpdate(PackagesUpdateReq) returns (PackagesUpdateRsp) {
|
||||||
option (micro.openapiv3.openapiv3_operation) = {
|
option (micro.openapiv3.openapiv3_operation) = {
|
||||||
operation_id: "PackagesUpdate";
|
operation_id: "PackagesUpdate";
|
||||||
@ -126,6 +150,22 @@ service PkgdashService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message PackagesModulesReq {
|
||||||
|
uint64 id = 1 [json_name = "id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message PackagesModulesRsp {
|
||||||
|
repeated Module modules = 1 [json_name = "modules"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message PackagesLookupReq {
|
||||||
|
uint64 id = 1 [json_name = "id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message PackagesLookupRsp {
|
||||||
|
Package package = 1 [json_name = "package"];
|
||||||
|
}
|
||||||
|
|
||||||
message ErrorRsp {
|
message ErrorRsp {
|
||||||
string code = 1 [json_name = "code"];
|
string code = 1 [json_name = "code"];
|
||||||
string title = 2 [json_name = "title"];
|
string title = 2 [json_name = "title"];
|
||||||
@ -137,11 +177,12 @@ message Package {
|
|||||||
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
||||||
string name = 2 [(validate.rules).string.min_len = 1];
|
string name = 2 [(validate.rules).string.min_len = 1];
|
||||||
string url = 3 [(validate.rules).string.min_len = 1];
|
string url = 3 [(validate.rules).string.min_len = 1];
|
||||||
repeated uint64 modules = 4;
|
uint64 modules = 4;
|
||||||
repeated uint64 issues = 5;
|
uint64 issues = 5;
|
||||||
repeated uint64 comments = 6;
|
uint64 comments = 6;
|
||||||
google.protobuf.Timestamp created = 7;
|
google.protobuf.Timestamp created = 7;
|
||||||
google.protobuf.Timestamp updated = 8;
|
google.protobuf.Timestamp updated = 8;
|
||||||
|
google.protobuf.Timestamp last_check = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Module {
|
message Module {
|
||||||
@ -167,7 +208,7 @@ message Issue {
|
|||||||
message Comment {
|
message Comment {
|
||||||
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
uint64 id = 1 [(validate.rules).uint64.gt = 0];
|
||||||
uint64 package = 2 [(validate.rules).uint64.gt = 0];
|
uint64 package = 2 [(validate.rules).uint64.gt = 0];
|
||||||
string text = 3;
|
string comment = 3;
|
||||||
google.protobuf.Timestamp created = 4;
|
google.protobuf.Timestamp created = 4;
|
||||||
google.protobuf.Timestamp updated = 5;
|
google.protobuf.Timestamp updated = 5;
|
||||||
}
|
}
|
||||||
@ -208,7 +249,7 @@ message CommentsCreateReq {
|
|||||||
json_name = "package_id",
|
json_name = "package_id",
|
||||||
(validate.rules).uint64.gt = 0
|
(validate.rules).uint64.gt = 0
|
||||||
];
|
];
|
||||||
string text = 2;
|
string comment = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CommentsCreateRsp {
|
message CommentsCreateRsp {
|
||||||
@ -222,13 +263,13 @@ message PackagesCreateReq {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message PackagesCreateRsp {
|
message PackagesCreateRsp {
|
||||||
string status = 1 [(validate.rules).string.min_len = 1];
|
Package package = 1 [json_name="package"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ModulesListReq {}
|
message ModulesListReq {}
|
||||||
|
|
||||||
message ModulesListRsp {
|
message ModulesListRsp {
|
||||||
repeated Module modules = 1;
|
repeated Module modules = 1 [json_name="modules"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message CommentsListReq {
|
message CommentsListReq {
|
||||||
|
@ -17,9 +17,11 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type PkgdashServiceClient interface {
|
type PkgdashServiceClient interface {
|
||||||
|
PackagesLookup(ctx context.Context, req *PackagesLookupReq, opts ...options.Option) (*PackagesLookupRsp, error)
|
||||||
PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error)
|
PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error)
|
||||||
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, opts ...options.Option) (*PackagesDeleteRsp, error)
|
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, opts ...options.Option) (*PackagesDeleteRsp, error)
|
||||||
PackagesList(ctx context.Context, req *PackagesListReq, opts ...options.Option) (*PackagesListRsp, error)
|
PackagesList(ctx context.Context, req *PackagesListReq, opts ...options.Option) (*PackagesListRsp, error)
|
||||||
|
PackagesModules(ctx context.Context, req *PackagesModulesReq, opts ...options.Option) (*PackagesModulesRsp, error)
|
||||||
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error)
|
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error)
|
||||||
CommentsCreate(ctx context.Context, req *CommentsCreateReq, opts ...options.Option) (*CommentsCreateRsp, error)
|
CommentsCreate(ctx context.Context, req *CommentsCreateReq, opts ...options.Option) (*CommentsCreateRsp, error)
|
||||||
CommentsLookup(ctx context.Context, req *CommentsLookupReq, opts ...options.Option) (*CommentsLookupRsp, error)
|
CommentsLookup(ctx context.Context, req *CommentsLookupReq, opts ...options.Option) (*CommentsLookupRsp, error)
|
||||||
@ -29,9 +31,11 @@ type PkgdashServiceClient interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PkgdashServiceServer interface {
|
type PkgdashServiceServer interface {
|
||||||
|
PackagesLookup(ctx context.Context, req *PackagesLookupReq, rsp *PackagesLookupRsp) error
|
||||||
PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error
|
PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error
|
||||||
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error
|
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error
|
||||||
PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error
|
PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error
|
||||||
|
PackagesModules(ctx context.Context, req *PackagesModulesReq, rsp *PackagesModulesRsp) error
|
||||||
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error
|
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error
|
||||||
CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error
|
CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error
|
||||||
CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error
|
CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error
|
||||||
|
@ -16,6 +16,13 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
PkgdashServiceServerEndpoints = []v4.EndpointMetadata{
|
PkgdashServiceServerEndpoints = []v4.EndpointMetadata{
|
||||||
|
{
|
||||||
|
Name: "PkgdashService.PackagesLookup",
|
||||||
|
Path: "/v1/packages/{id}",
|
||||||
|
Method: "GET",
|
||||||
|
Body: "",
|
||||||
|
Stream: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "PkgdashService.PackagesCreate",
|
Name: "PkgdashService.PackagesCreate",
|
||||||
Path: "/v1/packages",
|
Path: "/v1/packages",
|
||||||
@ -37,6 +44,13 @@ var (
|
|||||||
Body: "",
|
Body: "",
|
||||||
Stream: false,
|
Stream: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "PkgdashService.PackagesModules",
|
||||||
|
Path: "/v1/packages/{id}/modules",
|
||||||
|
Method: "GET",
|
||||||
|
Body: "",
|
||||||
|
Stream: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "PkgdashService.PackagesUpdate",
|
Name: "PkgdashService.PackagesUpdate",
|
||||||
Path: "/v1/packages/{id}",
|
Path: "/v1/packages/{id}",
|
||||||
@ -105,6 +119,24 @@ func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient
|
|||||||
return &pkgdashServiceClient{c: c, name: name}
|
return &pkgdashServiceClient{c: c, name: name}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *pkgdashServiceClient) PackagesLookup(ctx context.Context, req *PackagesLookupReq, opts ...options.Option) (*PackagesLookupRsp, 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/{id}"),
|
||||||
|
)
|
||||||
|
rsp := &PackagesLookupRsp{}
|
||||||
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesLookup", req), rsp, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rsp, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *pkgdashServiceClient) PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error) {
|
func (c *pkgdashServiceClient) PackagesCreate(ctx context.Context, req *PackagesCreateReq, opts ...options.Option) (*PackagesCreateRsp, error) {
|
||||||
errmap := make(map[string]interface{}, 1)
|
errmap := make(map[string]interface{}, 1)
|
||||||
errmap["default"] = &ErrorRsp{}
|
errmap["default"] = &ErrorRsp{}
|
||||||
@ -160,6 +192,24 @@ func (c *pkgdashServiceClient) PackagesList(ctx context.Context, req *PackagesLi
|
|||||||
return rsp, nil
|
return rsp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *pkgdashServiceClient) PackagesModules(ctx context.Context, req *PackagesModulesReq, opts ...options.Option) (*PackagesModulesRsp, 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/{id}/modules"),
|
||||||
|
)
|
||||||
|
rsp := &PackagesModulesRsp{}
|
||||||
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "PkgdashService.PackagesModules", req), rsp, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rsp, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *pkgdashServiceClient) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error) {
|
func (c *pkgdashServiceClient) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, opts ...options.Option) (*PackagesUpdateRsp, error) {
|
||||||
errmap := make(map[string]interface{}, 1)
|
errmap := make(map[string]interface{}, 1)
|
||||||
errmap["default"] = &ErrorRsp{}
|
errmap["default"] = &ErrorRsp{}
|
||||||
@ -274,6 +324,10 @@ type pkgdashServiceServer struct {
|
|||||||
PkgdashServiceServer
|
PkgdashServiceServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *pkgdashServiceServer) PackagesLookup(ctx context.Context, req *PackagesLookupReq, rsp *PackagesLookupRsp) error {
|
||||||
|
return h.PkgdashServiceServer.PackagesLookup(ctx, req, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *pkgdashServiceServer) PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error {
|
func (h *pkgdashServiceServer) PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error {
|
||||||
return h.PkgdashServiceServer.PackagesCreate(ctx, req, rsp)
|
return h.PkgdashServiceServer.PackagesCreate(ctx, req, rsp)
|
||||||
}
|
}
|
||||||
@ -286,6 +340,10 @@ func (h *pkgdashServiceServer) PackagesList(ctx context.Context, req *PackagesLi
|
|||||||
return h.PkgdashServiceServer.PackagesList(ctx, req, rsp)
|
return h.PkgdashServiceServer.PackagesList(ctx, req, rsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *pkgdashServiceServer) PackagesModules(ctx context.Context, req *PackagesModulesReq, rsp *PackagesModulesRsp) error {
|
||||||
|
return h.PkgdashServiceServer.PackagesModules(ctx, req, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *pkgdashServiceServer) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error {
|
func (h *pkgdashServiceServer) PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error {
|
||||||
return h.PkgdashServiceServer.PackagesUpdate(ctx, req, rsp)
|
return h.PkgdashServiceServer.PackagesUpdate(ctx, req, rsp)
|
||||||
}
|
}
|
||||||
@ -312,9 +370,11 @@ func (h *pkgdashServiceServer) ModulesList(ctx context.Context, req *ModulesList
|
|||||||
|
|
||||||
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...options.Option) error {
|
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...options.Option) error {
|
||||||
type pkgdashService interface {
|
type pkgdashService interface {
|
||||||
|
PackagesLookup(ctx context.Context, req *PackagesLookupReq, rsp *PackagesLookupRsp) error
|
||||||
PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error
|
PackagesCreate(ctx context.Context, req *PackagesCreateReq, rsp *PackagesCreateRsp) error
|
||||||
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error
|
PackagesDelete(ctx context.Context, req *PackagesDeleteReq, rsp *PackagesDeleteRsp) error
|
||||||
PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error
|
PackagesList(ctx context.Context, req *PackagesListReq, rsp *PackagesListRsp) error
|
||||||
|
PackagesModules(ctx context.Context, req *PackagesModulesReq, rsp *PackagesModulesRsp) error
|
||||||
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error
|
PackagesUpdate(ctx context.Context, req *PackagesUpdateReq, rsp *PackagesUpdateRsp) error
|
||||||
CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error
|
CommentsCreate(ctx context.Context, req *CommentsCreateReq, rsp *CommentsCreateRsp) error
|
||||||
CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error
|
CommentsLookup(ctx context.Context, req *CommentsLookupReq, rsp *CommentsLookupRsp) error
|
||||||
|
@ -14,5 +14,7 @@ export { PackagesCreateReq } from './models/packages-create-req';
|
|||||||
export { PackagesCreateRsp } from './models/packages-create-rsp';
|
export { PackagesCreateRsp } from './models/packages-create-rsp';
|
||||||
export { PackagesDeleteRsp } from './models/packages-delete-rsp';
|
export { PackagesDeleteRsp } from './models/packages-delete-rsp';
|
||||||
export { PackagesListRsp } from './models/packages-list-rsp';
|
export { PackagesListRsp } from './models/packages-list-rsp';
|
||||||
|
export { PackagesLookupRsp } from './models/packages-lookup-rsp';
|
||||||
|
export { PackagesModulesRsp } from './models/packages-modules-rsp';
|
||||||
export { PackagesUpdateReq } from './models/packages-update-req';
|
export { PackagesUpdateReq } from './models/packages-update-req';
|
||||||
export { PackagesUpdateRsp } from './models/packages-update-rsp';
|
export { PackagesUpdateRsp } from './models/packages-update-rsp';
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export interface Comment {
|
export interface Comment {
|
||||||
|
comment?: string;
|
||||||
created?: string;
|
created?: string;
|
||||||
id?: number;
|
id?: number;
|
||||||
package?: number;
|
package?: number;
|
||||||
text?: string;
|
|
||||||
updated?: string;
|
updated?: string;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export interface CommentsCreateReq {
|
export interface CommentsCreateReq {
|
||||||
|
comment?: string;
|
||||||
package_id?: number;
|
package_id?: number;
|
||||||
text?: string;
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export interface Package {
|
export interface Package {
|
||||||
comments?: Array<number>;
|
comments?: number;
|
||||||
created?: string;
|
created?: string;
|
||||||
id?: number;
|
id?: number;
|
||||||
issues?: Array<number>;
|
issues?: number;
|
||||||
modules?: Array<number>;
|
last_check?: string;
|
||||||
|
modules?: number;
|
||||||
name?: string;
|
name?: string;
|
||||||
updated?: string;
|
updated?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
import { Package } from './package';
|
||||||
export interface PackagesCreateRsp {
|
export interface PackagesCreateRsp {
|
||||||
status?: string;
|
package?: Package;
|
||||||
}
|
}
|
||||||
|
6
ui/src/app/api/models/packages-lookup-rsp.ts
Normal file
6
ui/src/app/api/models/packages-lookup-rsp.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import { Package } from './package';
|
||||||
|
export interface PackagesLookupRsp {
|
||||||
|
package?: Package;
|
||||||
|
}
|
6
ui/src/app/api/models/packages-modules-rsp.ts
Normal file
6
ui/src/app/api/models/packages-modules-rsp.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
import { Module } from './module';
|
||||||
|
export interface PackagesModulesRsp {
|
||||||
|
modules?: Array<Module>;
|
||||||
|
}
|
@ -20,6 +20,8 @@ import { PackagesCreateReq } from '../models/packages-create-req';
|
|||||||
import { PackagesCreateRsp } from '../models/packages-create-rsp';
|
import { PackagesCreateRsp } from '../models/packages-create-rsp';
|
||||||
import { PackagesDeleteRsp } from '../models/packages-delete-rsp';
|
import { PackagesDeleteRsp } from '../models/packages-delete-rsp';
|
||||||
import { PackagesListRsp } from '../models/packages-list-rsp';
|
import { PackagesListRsp } from '../models/packages-list-rsp';
|
||||||
|
import { PackagesLookupRsp } from '../models/packages-lookup-rsp';
|
||||||
|
import { PackagesModulesRsp } from '../models/packages-modules-rsp';
|
||||||
import { PackagesUpdateReq } from '../models/packages-update-req';
|
import { PackagesUpdateReq } from '../models/packages-update-req';
|
||||||
import { PackagesUpdateRsp } from '../models/packages-update-rsp';
|
import { PackagesUpdateRsp } from '../models/packages-update-rsp';
|
||||||
|
|
||||||
@ -214,6 +216,53 @@ export class PkgdashServiceService extends BaseService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Path part for operation `packagesLookup()` */
|
||||||
|
static readonly PackagesLookupPath = '/v1/packages/{id}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method provides access to the full `HttpResponse`, allowing access to response headers.
|
||||||
|
* To access only the response body, use `packagesLookup()` instead.
|
||||||
|
*
|
||||||
|
* This method doesn't expect any request body.
|
||||||
|
*/
|
||||||
|
packagesLookup$Response(
|
||||||
|
params: {
|
||||||
|
id: number;
|
||||||
|
},
|
||||||
|
context?: HttpContext
|
||||||
|
): Observable<StrictHttpResponse<PackagesLookupRsp>> {
|
||||||
|
const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.PackagesLookupPath, 'get');
|
||||||
|
if (params) {
|
||||||
|
rb.path('id', params.id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.http.request(
|
||||||
|
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||||
|
).pipe(
|
||||||
|
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||||
|
map((r: HttpResponse<any>) => {
|
||||||
|
return r as StrictHttpResponse<PackagesLookupRsp>;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method provides access only to the response body.
|
||||||
|
* To access the full response (for headers, for example), `packagesLookup$Response()` instead.
|
||||||
|
*
|
||||||
|
* This method doesn't expect any request body.
|
||||||
|
*/
|
||||||
|
packagesLookup(
|
||||||
|
params: {
|
||||||
|
id: number;
|
||||||
|
},
|
||||||
|
context?: HttpContext
|
||||||
|
): Observable<PackagesLookupRsp> {
|
||||||
|
return this.packagesLookup$Response(params, context).pipe(
|
||||||
|
map((r: StrictHttpResponse<PackagesLookupRsp>): PackagesLookupRsp => r.body)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/** Path part for operation `packagesUpdate()` */
|
/** Path part for operation `packagesUpdate()` */
|
||||||
static readonly PackagesUpdatePath = '/v1/packages/{id}';
|
static readonly PackagesUpdatePath = '/v1/packages/{id}';
|
||||||
|
|
||||||
@ -311,6 +360,53 @@ export class PkgdashServiceService extends BaseService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Path part for operation `packagesModules()` */
|
||||||
|
static readonly PackagesModulesPath = '/v1/packages/{id}/modules';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method provides access to the full `HttpResponse`, allowing access to response headers.
|
||||||
|
* To access only the response body, use `packagesModules()` instead.
|
||||||
|
*
|
||||||
|
* This method doesn't expect any request body.
|
||||||
|
*/
|
||||||
|
packagesModules$Response(
|
||||||
|
params: {
|
||||||
|
id: number;
|
||||||
|
},
|
||||||
|
context?: HttpContext
|
||||||
|
): Observable<StrictHttpResponse<PackagesModulesRsp>> {
|
||||||
|
const rb = new RequestBuilder(this.rootUrl, PkgdashServiceService.PackagesModulesPath, 'get');
|
||||||
|
if (params) {
|
||||||
|
rb.path('id', params.id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.http.request(
|
||||||
|
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||||
|
).pipe(
|
||||||
|
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||||
|
map((r: HttpResponse<any>) => {
|
||||||
|
return r as StrictHttpResponse<PackagesModulesRsp>;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method provides access only to the response body.
|
||||||
|
* To access the full response (for headers, for example), `packagesModules$Response()` instead.
|
||||||
|
*
|
||||||
|
* This method doesn't expect any request body.
|
||||||
|
*/
|
||||||
|
packagesModules(
|
||||||
|
params: {
|
||||||
|
id: number;
|
||||||
|
},
|
||||||
|
context?: HttpContext
|
||||||
|
): Observable<PackagesModulesRsp> {
|
||||||
|
return this.packagesModules$Response(params, context).pipe(
|
||||||
|
map((r: StrictHttpResponse<PackagesModulesRsp>): PackagesModulesRsp => r.body)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/** Path part for operation `commentsList()` */
|
/** Path part for operation `commentsList()` */
|
||||||
static readonly CommentsListPath = '/v1/packages/{package_id}/comments';
|
static readonly CommentsListPath = '/v1/packages/{package_id}/comments';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user