diff --git a/Makefile b/Makefile index a5323a7f23a128464b3dc5b6a76c35b29815038b..3c39f0beaa88f673e1f5fa3b8aa4023e36f81954 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,10 @@ TARGETS = darwin/amd64 darwin/arm64 linux/amd64 linux/386 windows/amd64 windows/ GIT_COMMIT = $(shell git rev-parse HEAD) BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n') GO_VERSION = $(shell go version | awk {'print $$3'}) -DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')" -DOCKER_LATEST_TAG = "sosedoff/pgweb:latest" +DOCKER_RELEASE_TAG = "sosedoff/openGauss-webclient:$(shell git describe --abbrev=0 --tags | sed 's/v//')" +DOCKER_LATEST_TAG = "sosedoff/openGauss-webclient:latest" LDFLAGS = -s -w -PKG = github.com/sosedoff/pgweb +PKG = github.com/sosedoff/openGauss-webclient usage: @echo "" @@ -33,11 +33,11 @@ test-all: dev: go build - @echo "You can now execute ./pgweb" + @echo "You can now execute ./openGauss-webclient" build: go build - @echo "You can now execute ./pgweb" + @echo "You can now execute ./openGauss-webclient" release: LDFLAGS += -X $(PKG)/pkg/command.GitCommit=$(GIT_COMMIT) release: LDFLAGS += -X $(PKG)/pkg/command.BuildTime=$(BUILD_TIME) @@ -47,13 +47,13 @@ release: @gox \ -osarch "$(TARGETS)" \ -ldflags "$(LDFLAGS)" \ - -output "./bin/pgweb_{{.OS}}_{{.Arch}}" + -output "./bin/openGauss-webclient_{{.OS}}_{{.Arch}}" @echo "Building ARM binaries..." - GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o "./bin/pgweb_linux_arm_v5" + GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o "./bin/openGauss-webclient_linux_arm_v5" @echo "Building ARM64 binaries..." - GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags "$(LDFLAGS)" -o "./bin/pgweb_linux_arm64_v7" + GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags "$(LDFLAGS)" -o "./bin/openGauss-webclient_linux_arm64_v7" @echo "\nPackaging binaries...\n" @./script/package.sh @@ -65,11 +65,11 @@ setup: go install github.com/mitchellh/gox@v1.0.1 clean: - @rm -f ./pgweb + @rm -f ./openGauss-webclient* @rm -rf ./bin/* docker: - docker build --no-cache -t pgweb . + docker build --no-cache -t openGauss-webclient . docker-release: docker build --no-cache -t $(DOCKER_RELEASE_TAG) . diff --git a/README.md b/README.md index cad9b37543e9978fbb14c548ebada5707f31f5c6..4088604317182cc098c3f0d6baee7a1792611896 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ Web-based openGauss database browser written in Go. ## Overview -Pgweb is a web-based database browser for PostgreSQL, written in Go and works +openGauss-webclient is a web-based database browser for openGauss, written in Go and works on OSX, Linux and Windows machines. Main idea behind using Go for backend development is to utilize ability of the compiler to produce zero-dependency binaries for -multiple platforms. Pgweb was created as an attempt to build very simple and portable -application to work with local or remote PostgreSQL databases. +multiple platforms. openGauss-webclient was created as an attempt to build very simple and portable +application to work with local or remote openGauss databases. ## Features @@ -62,11 +62,35 @@ SESSIONS=1 openGauss-webclient ``` +## Build from source + +Go 1.7 is required. You can install Go with honebrew: + +``` +brew install go +``` + +To compile source code run the following command: +``` +make setup +make dev +``` + +This will produce openGauss-webclient binary in the current directory. + +There's also a task to compile banaries for other operating system: +``` +make release +``` + +Under the hood it uses gox. Compiled binaries will be stored into ./bin directory. + + ## Testing -Before running tests, make sure you have PostgreSQL server running on `localhost:5432` +Before running tests, make sure you have openGauss server running on `localhost:5432` interface. Also, you must have `postgres` user that could create new databases -in your local environment. Pgweb server should not be running at the same time. +in your local environment. openGauss-webclient server should not be running at the same time. Execute test suite: @@ -75,7 +99,7 @@ make test ``` If you're using Docker locally, you might also run pgweb test suite against -all supported PostgreSQL version with a single command: +all supported openGauss version with a single command: ``` make test-all diff --git a/go.mod b/go.mod index 7902c73c8c75cdd4cee8fd8c943a635f40f7eb28..e0a8af18a7db6cd2e0a59488f1454973c9a60f89 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/sosedoff/pgweb +module github.com/sosedoff/openGauss-webclient go 1.17 diff --git a/main.go b/main.go index 272bec133cc09eeb4ca472204c4ef9cfb2d9706b..955c7190a65ded4f5fa4de4e21cba90fd90e77d0 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/sosedoff/pgweb/pkg/cli" + "github.com/sosedoff/openGauss-webclient/pkg/cli" ) func main() { diff --git a/pkg/api/api.go b/pkg/api/api.go index c9517279003976bf6ee85b2c30776fd4c136bfb8..ee0e4552eb533d0861e47eb212629884043921a2 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -13,12 +13,12 @@ import ( "github.com/gin-gonic/gin" "github.com/tuvistavie/securerandom" - "github.com/sosedoff/pgweb/pkg/bookmarks" - "github.com/sosedoff/pgweb/pkg/client" - "github.com/sosedoff/pgweb/pkg/command" - "github.com/sosedoff/pgweb/pkg/connection" - "github.com/sosedoff/pgweb/pkg/shared" - "github.com/sosedoff/pgweb/static" + "github.com/sosedoff/openGauss-webclient/pkg/bookmarks" + "github.com/sosedoff/openGauss-webclient/pkg/client" + "github.com/sosedoff/openGauss-webclient/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/connection" + "github.com/sosedoff/openGauss-webclient/pkg/shared" + "github.com/sosedoff/openGauss-webclient/static" ) var ( diff --git a/pkg/api/helpers.go b/pkg/api/helpers.go index f56093ad6444b5257a25d58691d78af25a1ca6b1..46516e6f28d501c5fad10a98fca0e7173d7e47f5 100644 --- a/pkg/api/helpers.go +++ b/pkg/api/helpers.go @@ -10,7 +10,7 @@ import ( "github.com/gin-gonic/gin" - "github.com/sosedoff/pgweb/pkg/shared" + "github.com/sosedoff/openGauss-webclient/pkg/shared" ) var ( diff --git a/pkg/api/middleware.go b/pkg/api/middleware.go index f20dffb813951ba62e104d3bbbf902d9e1d206a3..43772ddcf1486c1956e258ce87eb0daf992fc814 100644 --- a/pkg/api/middleware.go +++ b/pkg/api/middleware.go @@ -6,7 +6,7 @@ import ( "github.com/gin-gonic/gin" - "github.com/sosedoff/pgweb/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/command" ) // Middleware to check database connection status before running queries diff --git a/pkg/api/routes.go b/pkg/api/routes.go index 3f94f5f2800d3c91aab23c4e0e50b85bab78fdc8..7cfb1dae1c58d232b30bcbca46d279ced7808a72 100644 --- a/pkg/api/routes.go +++ b/pkg/api/routes.go @@ -3,7 +3,7 @@ package api import ( "github.com/gin-gonic/gin" - "github.com/sosedoff/pgweb/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/command" ) func SetupMiddlewares(group *gin.RouterGroup) { diff --git a/pkg/api/session_cleanup.go b/pkg/api/session_cleanup.go index 862d1219ac730566f833db70adc71c302d6c4e58..68469a240b277fa91b8bb075a8187c401b5ec984 100644 --- a/pkg/api/session_cleanup.go +++ b/pkg/api/session_cleanup.go @@ -4,7 +4,7 @@ import ( "log" "time" - "github.com/sosedoff/pgweb/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/command" ) // StartSessionCleanup starts a goroutine to cleanup idle database sessions diff --git a/pkg/bookmarks/bookmarks.go b/pkg/bookmarks/bookmarks.go index 2648b04702175a8e35dcbb97e8113c39ea9e357c..8e8a3e4047f944098ad807f87539b5aec09738a3 100644 --- a/pkg/bookmarks/bookmarks.go +++ b/pkg/bookmarks/bookmarks.go @@ -9,8 +9,8 @@ import ( "github.com/BurntSushi/toml" "github.com/mitchellh/go-homedir" - "github.com/sosedoff/pgweb/pkg/command" - "github.com/sosedoff/pgweb/pkg/shared" + "github.com/sosedoff/openGauss-webclient/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/shared" ) // Bookmark contains information about bookmarked database connection diff --git a/pkg/cli/cli.go b/pkg/cli/cli.go index 64d527f12fd9d9a04777fc41ac96c1988ff79a1c..21cc8498ffa6368d74e5911dc7271ad0e326d82a 100644 --- a/pkg/cli/cli.go +++ b/pkg/cli/cli.go @@ -11,13 +11,13 @@ import ( "github.com/gin-gonic/gin" "github.com/jessevdk/go-flags" - "github.com/sosedoff/pgweb/pkg/api" - "github.com/sosedoff/pgweb/pkg/bookmarks" - "github.com/sosedoff/pgweb/pkg/client" - "github.com/sosedoff/pgweb/pkg/command" - "github.com/sosedoff/pgweb/pkg/connection" - "github.com/sosedoff/pgweb/pkg/shared" - "github.com/sosedoff/pgweb/pkg/util" + "github.com/sosedoff/openGauss-webclient/pkg/api" + "github.com/sosedoff/openGauss-webclient/pkg/bookmarks" + "github.com/sosedoff/openGauss-webclient/pkg/client" + "github.com/sosedoff/openGauss-webclient/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/connection" + "github.com/sosedoff/openGauss-webclient/pkg/shared" + "github.com/sosedoff/openGauss-webclient/pkg/util" ) var ( diff --git a/pkg/client/client.go b/pkg/client/client.go index 865a2e386aca30d820319ea5cbea5c2eefa59ca8..da6664e87d86d3ea3431ab7625daf72d6bc9d5f5 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -13,11 +13,11 @@ import ( "github.com/jmoiron/sqlx" _ "github.com/lib/pq" - "github.com/sosedoff/pgweb/pkg/command" - "github.com/sosedoff/pgweb/pkg/connection" - "github.com/sosedoff/pgweb/pkg/history" - "github.com/sosedoff/pgweb/pkg/shared" - "github.com/sosedoff/pgweb/pkg/statements" + "github.com/sosedoff/openGauss-webclient/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/connection" + "github.com/sosedoff/openGauss-webclient/pkg/history" + "github.com/sosedoff/openGauss-webclient/pkg/shared" + "github.com/sosedoff/openGauss-webclient/pkg/statements" ) var ( diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 4d3f59dc2f07de9f199b305ca5d86ceea575a373..dddc67639892d8c84712ed71f8b9178b894024f7 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/sosedoff/pgweb/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/command" "github.com/stretchr/testify/assert" ) diff --git a/pkg/client/result.go b/pkg/client/result.go index 4cef6691ac25f44e210e2f8e2198090104d63c0b..df977d6d3733b8f503d1e168f18692dc66f2a1c1 100644 --- a/pkg/client/result.go +++ b/pkg/client/result.go @@ -9,7 +9,7 @@ import ( "strconv" "time" - "github.com/sosedoff/pgweb/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/command" ) type Row []interface{} diff --git a/pkg/client/tunnel.go b/pkg/client/tunnel.go index 784c01e6d6a8c522c375cce0d312898e8533469a..7f236a65d0c359df679cda3210811f838feafbf1 100644 --- a/pkg/client/tunnel.go +++ b/pkg/client/tunnel.go @@ -16,8 +16,8 @@ import ( "github.com/ScaleFT/sshkeys" "golang.org/x/crypto/ssh" - "github.com/sosedoff/pgweb/pkg/connection" - "github.com/sosedoff/pgweb/pkg/shared" + "github.com/sosedoff/openGauss-webclient/pkg/connection" + "github.com/sosedoff/openGauss-webclient/pkg/shared" ) const ( diff --git a/pkg/connection/connection_string.go b/pkg/connection/connection_string.go index 3ca831c3a3ec60c48ff16529c3572211a2e043e7..901a0da3ac72aef1445ded2acdea7499c8448416 100644 --- a/pkg/connection/connection_string.go +++ b/pkg/connection/connection_string.go @@ -8,7 +8,7 @@ import ( "os/user" "strings" - "github.com/sosedoff/pgweb/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/command" ) // Common errors diff --git a/pkg/connection/connection_string_test.go b/pkg/connection/connection_string_test.go index ce82bfe000663ff91c812fdb8b0a97d86bcbb082..7cfca6bb0c444b7bb7534fa878e10daf1226440d 100644 --- a/pkg/connection/connection_string_test.go +++ b/pkg/connection/connection_string_test.go @@ -6,7 +6,7 @@ import ( "os/user" "testing" - "github.com/sosedoff/pgweb/pkg/command" + "github.com/sosedoff/openGauss-webclient/pkg/command" "github.com/stretchr/testify/assert" )