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:
28
storage/postgres/queries.go
Normal file
28
storage/postgres/queries.go
Normal 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;
|
||||
`
|
||||
)
|
@@ -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"
|
||||
)
|
||||
|
Reference in New Issue
Block a user