Skip to content

Commit

Permalink
rename pg_goback to pg_back
Browse files Browse the repository at this point in the history
  • Loading branch information
orgrim committed Mar 5, 2021
1 parent e3ad483 commit c777ed2
Show file tree
Hide file tree
Showing 24 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pg_goback
pg_back
cover.out
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

all: pg_goback
all: pg_back

pg_goback: *.go
pg_back: *.go
go build -ldflags="-s -w" .

test:
Expand All @@ -18,6 +18,6 @@ install:

clean:
rm -rf test
-rm cover.out pg_goback
-rm cover.out pg_back

.PHONY: all pg_goback test coverage coverage-html
.PHONY: all pg_back test coverage coverage-html
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# pg_goback dumps databases from PostgreSQL
# pg_back dumps databases from PostgreSQL

## Description

pg_goback is a dump tool for PostgreSQL. The goal is to dump all or some
pg_back is a dump tool for PostgreSQL. The goal is to dump all or some
databases with globals at once in the format you want, because a simple call to
pg_dumpall only dumps databases in the plain SQL format.

Behind the scene, pg_goback uses pg_dumpall to dump roles and tablespaces
Behind the scene, pg_back uses pg_dumpall to dump roles and tablespaces
definitions, pg_dump to dump all or each selected database to a separate file
in the custom format. It also extract database level ACL and configuration that
is not dumped by pg_dump older than 11. Finally, it dumps all configuration
Expand All @@ -28,7 +28,7 @@ options of the PostgreSQL instance.
## Install

```
go get -u github.com/orgrim/pg_goback
go get -u github.com/orgrim/pg_back
```

Use `make` to build and install from source as an alternative.
Expand Down Expand Up @@ -104,7 +104,7 @@ post backup hook is executed when present.
## Managing the configuration file

Give the path of the v1 configuration file to the `--convert-legacy-config`
command line option, and pg_goback will try its best to convert it to the v2
command line option, and pg_back will try its best to convert it to the v2
format.

The default configuration file can be printed with the `--print-default-config`
Expand Down Expand Up @@ -135,5 +135,5 @@ Please use the issues and pull requests features from Github.

PostgreSQL - See [LICENSE][license] file

[license]: https://github.com/orgrim/pg_goback/blob/master/LICENSE
[license]: https://github.com/orgrim/pg_back/blob/master/LICENSE
[pg_dump]: https://www.postgresql.org/docs/current/app-pgdump.html
12 changes: 6 additions & 6 deletions config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down Expand Up @@ -38,9 +38,9 @@ import (
"time"
)

var defaultCfgFile = "/etc/pg_goback/pg_goback.conf"
var defaultCfgFile = "/etc/pg_back/pg_back.conf"

//go:embed pg_goback.conf
//go:embed pg_back.conf
var defaultCfg string

// options struct holds command line and configuration file options
Expand Down Expand Up @@ -154,9 +154,9 @@ func parseCli(args []string) (options, []string, error) {
pce := &parseCliResult{}

pflag.Usage = func() {
fmt.Fprintf(os.Stderr, "pg_goback dumps some PostgreSQL databases\n\n")
fmt.Fprintf(os.Stderr, "pg_back dumps some PostgreSQL databases\n\n")
fmt.Fprintf(os.Stderr, "Usage:\n")
fmt.Fprintf(os.Stderr, " pg_goback [OPTION]... [DBNAME]...\n")
fmt.Fprintf(os.Stderr, " pg_back [OPTION]... [DBNAME]...\n")
fmt.Fprintf(os.Stderr, "\nOptions:\n")
pflag.CommandLine.SortFlags = false
pflag.PrintDefaults()
Expand Down Expand Up @@ -217,7 +217,7 @@ func parseCli(args []string) (options, []string, error) {
}

if pce.ShowVersion {
fmt.Printf("pg_goback version %v\n", version)
fmt.Printf("pg_back version %v\n", version)
return opts, changed, pce
}

Expand Down
22 changes: 11 additions & 11 deletions config_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestDefaultOptions(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
}

Expand Down Expand Up @@ -161,7 +161,7 @@ func TestParseCli(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
},
false,
Expand All @@ -181,7 +181,7 @@ func TestParseCli(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
},
false,
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestLoadConfigurationFile(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
},
},
Expand All @@ -295,7 +295,7 @@ func TestLoadConfigurationFile(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
},
},
Expand All @@ -312,7 +312,7 @@ func TestLoadConfigurationFile(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
},
},
Expand All @@ -329,7 +329,7 @@ func TestLoadConfigurationFile(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: "2006-01-02_15-04-05",
},
},
Expand Down Expand Up @@ -364,7 +364,7 @@ func TestLoadConfigurationFile(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
PgDumpOpts: []string{"-O", "-x"},
PerDbOpts: map[string]*dbOpts{"db": &dbOpts{
Expand Down Expand Up @@ -401,7 +401,7 @@ func TestLoadConfigurationFile(t *testing.T) {
PurgeInterval: -30 * 24 * time.Hour,
PurgeKeep: 0,
SumAlgo: "none",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
PgDumpOpts: []string{"-O", "-x"},
PerDbOpts: map[string]*dbOpts{"db": &dbOpts{
Expand Down Expand Up @@ -470,7 +470,7 @@ func TestMergeCliAndConfigoptions(t *testing.T) {
SumAlgo: "sha256",
PreHook: "touch /tmp/pre-hook",
PostHook: "touch /tmp/post-hook",
CfgFile: "/etc/pg_goback/pg_goback.conf",
CfgFile: "/etc/pg_back/pg_back.conf",
TimeFormat: time.RFC3339,
}

Expand Down
6 changes: 3 additions & 3 deletions connstring.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down Expand Up @@ -236,8 +236,8 @@ func prepareConnInfo(host string, port int, username string, dbname string) stri
}

if !strings.Contains(conninfo, "application_name") {
l.Verboseln("using pg_goback as application_name")
conninfo += "application_name=pg_goback"
l.Verboseln("using pg_back as application_name")
conninfo += "application_name=pg_back"
}

return conninfo
Expand Down
18 changes: 9 additions & 9 deletions connstring_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down Expand Up @@ -139,14 +139,14 @@ func TestPrepareConnInfo(t *testing.T) {
dbname string
want string
}{
{"/tmp", 0, "", "", "host=/tmp application_name=pg_goback"},
{"localhost", 5432, "postgres", "postgres", "host=localhost port=5432 user=postgres dbname=postgres application_name=pg_goback"},
{"localhost", 0, "postgres", "postgres", "host=localhost user=postgres dbname=postgres application_name=pg_goback"},
{"localhost", 5432, "", "postgres", "host=localhost port=5432 dbname=postgres application_name=pg_goback"},
{"localhost", 5432, "postgres", "", "host=localhost port=5432 user=postgres application_name=pg_goback"},
{"localhost", 0, "postgres", "", "host=localhost user=postgres application_name=pg_goback"},
{"", 0, "postgres", "", "host=/tmp user=postgres application_name=pg_goback"},
{"localhost", 0, "postgres", "host=/tmp port=5432", "host=/tmp port=5432 application_name=pg_goback"},
{"/tmp", 0, "", "", "host=/tmp application_name=pg_back"},
{"localhost", 5432, "postgres", "postgres", "host=localhost port=5432 user=postgres dbname=postgres application_name=pg_back"},
{"localhost", 0, "postgres", "postgres", "host=localhost user=postgres dbname=postgres application_name=pg_back"},
{"localhost", 5432, "", "postgres", "host=localhost port=5432 dbname=postgres application_name=pg_back"},
{"localhost", 5432, "postgres", "", "host=localhost port=5432 user=postgres application_name=pg_back"},
{"localhost", 0, "postgres", "", "host=localhost user=postgres application_name=pg_back"},
{"", 0, "postgres", "", "host=/tmp user=postgres application_name=pg_back"},
{"localhost", 0, "postgres", "host=/tmp port=5432", "host=/tmp port=5432 application_name=pg_back"},
}

for i, subt := range tests {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/orgrim/pg_goback
module github.com/orgrim/pg_back

go 1.16

Expand Down
2 changes: 1 addition & 1 deletion hash.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion hash_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion hook.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion hook_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion legacy.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion legacy_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion lock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion lock_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion log.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion log_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion pg_goback.conf → pg_back.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pg_goback configuration file
# pg_back configuration file

# PostgreSQL binaries path. Leave empty to search $PATH
bin_directory =
Expand Down
2 changes: 1 addition & 1 deletion purge.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion purge_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion sql.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion sql_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pg_goback
// pg_back
//
// Copyright 2020-2021 Nicolas Thauvin. All rights reserved.
//
Expand Down

0 comments on commit c777ed2

Please sign in to comment.