Documentation
¶
Overview ¶
Package postgres implements the ditto Engine interface for PostgreSQL. It registers itself via init() so that a blank import in main.go is sufficient to make the engine available.
Index ¶
- type Engine
- func (e *Engine) ConnectionString(host string, port int) string
- func (e *Engine) ContainerEnv() []string
- func (e *Engine) ContainerImage() string
- func (e *Engine) Dump(ctx context.Context, docker *client.Client, clientImage string, ...) error
- func (e *Engine) DumpFromContainer(ctx context.Context, docker *client.Client, containerName string, ...) error
- func (e *Engine) Name() string
- func (e *Engine) Restore(ctx context.Context, docker *client.Client, dumpPath string, ...) error
- func (e *Engine) WaitReady(port int, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine implements engine.Engine for PostgreSQL.
func (*Engine) ContainerEnv ¶
func (*Engine) ContainerImage ¶
func (*Engine) Dump ¶
func (e *Engine) Dump( ctx context.Context, docker *client.Client, clientImage string, src engine.SourceConfig, destPath string, opts engine.DumpOptions, ) error
Dump runs pg_dump inside a short-lived helper container and writes a custom-format compressed dump to destPath. When opts.SchemaOnly is true, --schema-only is passed so only DDL is captured (no row data).
func (*Engine) DumpFromContainer ¶
func (e *Engine) DumpFromContainer(ctx context.Context, docker *client.Client, containerName string, destPath string, opts engine.DumpOptions) error
DumpFromContainer creates a compressed dump of the ditto database running inside containerName and writes it to destPath on the host. The container must have its dump directory mounted at /dump (read-write). When opts.SchemaOnly is true, --schema-only is passed to pg_dump.
func (*Engine) Restore ¶
func (e *Engine) Restore(ctx context.Context, docker *client.Client, dumpPath string, containerName string) error
Restore calls pg_restore inside the running container by exec-ing into it. containerName is the Docker container name (e.g. "ditto-<id>") as set by the copy manager. The manager calls WaitReady before Restore, so readiness is already guaranteed when this method is invoked.