Documentation ¶
Overview ¶
Package postgres implements the sq driver for postgres.
Index ¶
- func DumpCatalogCmd(src *source.Source, p *ToolParams) (*execz.Cmd, error)
- func DumpClusterCmd(src *source.Source, p *ToolParams) (*execz.Cmd, error)
- func ExecCmd(src *source.Source, p *ExecToolParams) (*execz.Cmd, error)
- func RestoreCatalogCmd(src *source.Source, p *ToolParams) (*execz.Cmd, error)
- func RestoreClusterCmd(src *source.Source, p *ToolParams) (*execz.Cmd, error)
- type ExecToolParams
- type Provider
- type ToolParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpCatalogCmd ¶ added in v0.47.4
DumpCatalogCmd returns the shell command to execute pg_dump for src. Example output:
pg_dump -Fc -d postgres://alice:vNgR6R@db.acme.com:5432/sales sales.dump
Reference:
- https://www.postgresql.org/docs/9.6/app-pgdump.html
- https://www.postgresql.org/docs/9.6/app-pgrestore.html
See also: RestoreCatalogCmd.
func DumpClusterCmd ¶ added in v0.47.4
DumpClusterCmd returns the shell command to execute pg_dumpall for src. Example output (components concatenated with space):
PGPASSWORD=vNgR6R pg_dumpall -w -l sales -d postgres://alice:vNgR6R@db.acme.com:5432/sales -f cluster.dump
Note that the dump produced by pg_dumpall is executed by psql, not pg_restore.
- https://www.postgresql.org/docs/9.6/app-pg-dumpall.html
- https://www.postgresql.org/docs/9.6/app-psql.html
- https://www.postgresql.org/docs/9.6/app-pgdump.html
- https://www.postgresql.org/docs/9.6/app-pgrestore.html
- https://cloud.google.com/sql/docs/postgres/import-export/import-export-dmp
See also: RestoreClusterCmd.
func ExecCmd ¶ added in v0.47.4
ExecCmd returns the shell command to execute psql with a script file or command string. Example command:
psql -d postgres://alice:vNgR6R@db.acme.com:5432/sales -f query.sql
func RestoreCatalogCmd ¶ added in v0.47.4
RestoreCatalogCmd returns the shell command to restore a pg catalog (db) from a dump produced by pg_dump (DumpClusterCmd). Example command:
pg_restore -d postgres://alice:vNgR6R@db.acme.com:5432/sales sales.dump
Reference:
- https://www.postgresql.org/docs/9.6/app-pgrestore.html
- https://www.postgresql.org/docs/9.6/app-pgdump.html
See also: DumpCatalogCmd.
func RestoreClusterCmd ¶ added in v0.47.4
RestoreClusterCmd returns the shell command to restore a pg cluster from a dump produced by pg_dumpall (DumpClusterCmd). Note that the dump produced by pg_dumpall is executed by psql, not pg_restore. Example command:
psql -d postgres://alice:vNgR6R@db.acme.com:5432/sales -f sales.dump
Reference:
- https://www.postgresql.org/docs/9.6/app-pg-dumpall.html
- https://www.postgresql.org/docs/9.6/app-psql.html
- https://www.postgresql.org/docs/9.6/app-pgdump.html
- https://www.postgresql.org/docs/9.6/app-pgrestore.html
- https://cloud.google.com/sql/docs/postgres/import-export/import-export-dmp
See also: DumpClusterCmd.
Types ¶
type ExecToolParams ¶ added in v0.47.4
type ExecToolParams struct { // ScriptFile is the path to the script file. // Only one of ScriptFile or CmdString will be set. ScriptFile string // CmdString is the literal SQL command string. CmdString string // Verbose indicates verbose output (progress). // Only one of ScriptFile or CmdString will be set. Verbose bool // LongFlags indicates whether to use long flags, e.g. --file instead of -f. LongFlags bool }
type ToolParams ¶ added in v0.47.4
type ToolParams struct { // File is the path to the file. File string // Verbose indicates verbose output (progress). Verbose bool // NoOwner won't output commands to set ownership of objects; the source's // connection user will own all objects. This also sets the --no-acl flag. // Maybe NoOwner should be named "no security" or similar? NoOwner bool // LongFlags indicates whether to use long flags, e.g. --no-owner instead // of -O. LongFlags bool }
ToolParams are parameters for postgres tools such as pg_dump and pg_restore.
- https://www.postgresql.org/docs/9.6/app-pgdump.html - https://www.postgresql.org/docs/9.6/app-pgrestore.html. - https://www.postgresql.org/docs/9.6/app-pg-dumpall.html - https://cloud.google.com/sql/docs/postgres/import-export/import-export-dmp
Not every flag is applicable to all tools.