dumper

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drivers

func Drivers() []string

Drivers returns a sorted list of the names of the registered drivers.

func Register

func Register(name string, driver Driver)

Register makes a database driver available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type ConnOpts

type ConnOpts struct {
	// DSN is the connection address.
	DSN string
	// IsRDS identifies if the server is an AWS RDS server
	IsRDS bool
	// Timeout is the timeout for dump operations.
	Timeout time.Duration
	// MaxConnLifetime is the maximum amount of time a connection may be reused on the read database.
	MaxConnLifetime time.Duration
	// MaxConns is the maximum number of open connections to the target database.
	MaxConns int
	// MaxIdleConns is the maximum number of connections in the idle connection pool for the write database.
	MaxIdleConns int
}

ConnOpts are the options to create a connection

type Driver

type Driver interface {
	// IsSupported checks if the given dsn connection string is supported.
	IsSupported(dsn string) bool
	// NewConnection creates a new database connection and retrieves a dumper implementation.
	NewConnection(ConnOpts, reader.Reader) (Dumper, error)
}

Driver is a driver interface used to support multiple drivers

type Dumper

type Dumper interface {
	// Dump executes the dump process.
	Dump(chan<- struct{}, config.Tables, int, bool) error
	// Close closes the dumper resources and releases them.
	Close() error
}

A Dumper writes a database's structure to the provided stream.

func NewDumper

func NewDumper(opts ConnOpts, rdr reader.Reader) (dumper Dumper, err error)

NewDumper is a factory method that will create a dumper based on the provided DSN

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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