Merge branch 'rewrite'

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

View File

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

View File

@@ -6,14 +6,14 @@ import (
"embed"
"errors"
"fmt"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"strings"
"github.com/golang-migrate/migrate/v4"
mpgx "github.com/golang-migrate/migrate/v4/database/pgx"
"github.com/golang-migrate/migrate/v4/source/iofs"
"github.com/lib/pq"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/unistack-org/pkgdash/config"
"go.unistack.org/unistack-org/pkgdash/models"
)

View File

@@ -8,16 +8,15 @@ import (
"fmt"
"strings"
_ "github.com/mattn/go-sqlite3"
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database/sqlite"
"github.com/golang-migrate/migrate/v4/source/iofs"
"github.com/lib/pq"
"go.unistack.org/micro/v3/logger"
_ "github.com/mattn/go-sqlite3"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/unistack-org/pkgdash/config"
"go.unistack.org/unistack-org/pkgdash/models"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
pb "go.unistack.org/unistack-org/pkgdash/proto"
)
const (

View File

@@ -4,20 +4,18 @@ import (
"context"
"database/sql"
"embed"
"go.unistack.org/unistack-org/pkgdash/models"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
"go.unistack.org/unistack-org/pkgdash/storage/postgres"
"go.unistack.org/unistack-org/pkgdash/storage/sqlite"
cmsstorage "go.unistack.org/cms-service/storage"
"go.unistack.org/unistack-org/pkgdash/models"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"go.unistack.org/unistack-org/pkgdash/storage/postgres"
"go.unistack.org/unistack-org/pkgdash/storage/sqlite"
)
//go:embed migrations
var fs embed.FS
var (
storages = cmsstorage.NewStorageInterface()
)
var storages = cmsstorage.NewStorageInterface()
func init() {
storages.RegisterStorage("postgres", postgres.NewStorageFS(fs))

View File

@@ -4,7 +4,7 @@ import (
"context"
"database/sql"
"fmt"
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"go.unistack.org/unistack-org/pkgdash/storage/sqlite"
"testing"
)