mysql

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package mysql implements the ditto Engine interface for MySQL and MariaDB. It registers itself via init() so that a blank import in main.go is sufficient to make the engine available.

Index

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 MySQL / MariaDB.

func (*Engine) ConnectionString

func (e *Engine) ConnectionString(host string, port int) string

func (*Engine) ContainerEnv

func (e *Engine) ContainerEnv() []string

func (*Engine) ContainerImage

func (e *Engine) ContainerImage() string

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 mysqldump inside a short-lived helper container, then compresses the resulting SQL dump to destPath. When opts.SchemaOnly is true, --no-data is passed so only DDL is captured.

func (*Engine) DumpFromContainer

func (e *Engine) DumpFromContainer(ctx context.Context, docker *client.Client, containerName string, destPath string, opts engine.DumpOptions) error

DumpFromContainer creates a gzip-compressed mysqldump 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, --no-data is passed to mysqldump.

func (*Engine) Name

func (e *Engine) Name() string

func (*Engine) Restore

func (e *Engine) Restore(ctx context.Context, docker *client.Client, dumpPath string, containerName string) error

Restore calls mysql inside the container to load the dump file. 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.

func (*Engine) WaitReady

func (e *Engine) WaitReady(port int, timeout time.Duration) error

WaitReady polls port until MySQL is accepting connections.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL