We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What if we need to take only schema backup without data? (pg_dump -s)
What if we need to take a specific schema backup with database?(pg_dump -n
The text was updated successfully, but these errors were encountered:
Hey @PGPAWAN
You can override your options here: dump.Options = []string{"-s"} or dump.Options = []string{"-n"}
dump.Options = []string{"-s"}
dump.Options = []string{"-n"}
package main import ( "fmt" "os" pg "github.com/habx/pg-commands" ) func main() { dump, err := pg.NewDump(&pg.Postgres{ Host: "localhost", Port: 5432, DB: "dev_example", Username: "example", Password: "example", }) if err != nil { panic(err) } dump.EnableVerbose() dump.ResetOptions() // plain text fmt format := "p" dump.Format = &format dump.SetFileName("test.sql") dump.SetPath("examples/") // --- SETUP YOUR OPTIONS HERE --- dump.Options = []string{"-s"} // --- --- --- --- --- --- --- --- dumpExec := dump.Exec(pg.ExecOptions{StreamPrint: true, StreamDestination: os.Stdout}) if dumpExec.Error != nil { fmt.Println(dumpExec.Error.Err) fmt.Println(dumpExec.Output) } else { fmt.Println("Dump success") fmt.Println(dumpExec.Output) } fmt.Println("full command executed: pg_dump", dumpExec.FullCommand) }
logs: full command executed: pg_dump -s --dbname=dev_example --host=localhost --port=5432 --username=example -Fp -v -fexamples/test.sql
full command executed: pg_dump -s --dbname=dev_example --host=localhost --port=5432 --username=example -Fp -v -fexamples/test.sql
Does this solve your problem?
Sorry, something went wrong.
No branches or pull requests
What if we need to take only schema backup without data? (pg_dump -s)
What if we need to take a specific schema backup with database?(pg_dump -n
The text was updated successfully, but these errors were encountered: