db

package
v0.0.0-...-d533c68 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAdapter

func RegisterAdapter(adapter DBAdapter)

Types

type BackUpOptions

type BackUpOptions struct {
	Storage   string
	Compress  bool
	Algorithm string
	FileName  string
	OutputDir string
}

type ConnectionParams

type ConnectionParams struct {
	DBType   string
	DBName   string
	Password string
	User     string
	Host     string
	Port     int
	DBUri    string

	TLS        TLSConfig
	IsPhysical bool
}

func (*ConnectionParams) ParseURI

func (c *ConnectionParams) ParseURI() error

type DBAdapter

type DBAdapter interface {
	Name() string
	TestConnection(ctx context.Context, conn ConnectionParams, runner Runner) error
	BuildConnection(ctx context.Context, conn ConnectionParams) (string, error)
	RunBackup(ctx context.Context, conn ConnectionParams, runner Runner, w io.Writer) error
	RunRestore(ctx context.Context, conn ConnectionParams, runner Runner, r io.Reader) error
	SetLogger(l *logger.Logger)
}

func GetAdapter

func GetAdapter(name string) (DBAdapter, error)

type DryRunRunner

type DryRunRunner struct {
	// contains filtered or unexported fields
}

func NewDryRunRunner

func NewDryRunRunner(l *logger.Logger) *DryRunRunner

func (*DryRunRunner) Run

func (d *DryRunRunner) Run(ctx context.Context, name string, args []string, w io.Writer) error

func (*DryRunRunner) RunWithIO

func (d *DryRunRunner) RunWithIO(ctx context.Context, name string, args []string, stdin io.Reader, stdout io.Writer) error

type LocalRunner

type LocalRunner struct {
	// contains filtered or unexported fields
}

func NewLocalRunner

func NewLocalRunner(l *logger.Logger) *LocalRunner

func (*LocalRunner) Run

func (r *LocalRunner) Run(ctx context.Context, name string, args []string, w io.Writer) error

func (*LocalRunner) RunWithIO

func (r *LocalRunner) RunWithIO(ctx context.Context, name string, args []string, stdin io.Reader, stdout io.Writer) error

type MysqlAdapter

type MysqlAdapter struct {
	// contains filtered or unexported fields
}

func (*MysqlAdapter) BuildConnection

func (ma *MysqlAdapter) BuildConnection(ctx context.Context, conn ConnectionParams) (string, error)

func (*MysqlAdapter) Name

func (ma *MysqlAdapter) Name() string

func (*MysqlAdapter) RunBackup

func (ma *MysqlAdapter) RunBackup(ctx context.Context, conn ConnectionParams, runner Runner, w io.Writer) error

func (*MysqlAdapter) RunRestore

func (ma *MysqlAdapter) RunRestore(ctx context.Context, conn ConnectionParams, runner Runner, r io.Reader) error

func (*MysqlAdapter) SetLogger

func (ma *MysqlAdapter) SetLogger(l *logger.Logger)

func (*MysqlAdapter) TestConnection

func (ma *MysqlAdapter) TestConnection(ctx context.Context, conn ConnectionParams, runner Runner) error

type PostgresAdapter

type PostgresAdapter struct {
	// contains filtered or unexported fields
}

func (*PostgresAdapter) BuildConnection

func (pa *PostgresAdapter) BuildConnection(ctx context.Context, conn ConnectionParams) (string, error)

func (*PostgresAdapter) Name

func (pa *PostgresAdapter) Name() string

func (*PostgresAdapter) RunBackup

func (pa *PostgresAdapter) RunBackup(ctx context.Context, conn ConnectionParams, runner Runner, w io.Writer) error

func (*PostgresAdapter) RunRestore

func (pa *PostgresAdapter) RunRestore(ctx context.Context, conn ConnectionParams, runner Runner, r io.Reader) error

func (*PostgresAdapter) SetLogger

func (pa *PostgresAdapter) SetLogger(l *logger.Logger)

func (*PostgresAdapter) TestConnection

func (pa *PostgresAdapter) TestConnection(ctx context.Context, conn ConnectionParams, runner Runner) error

type Runner

type Runner interface {
	Run(ctx context.Context, name string, args []string, w io.Writer) error
	RunWithIO(ctx context.Context, name string, args []string, r io.Reader, w io.Writer) error
}

type SqliteAdapter

type SqliteAdapter struct {
	Logger *logger.Logger
}

func (*SqliteAdapter) BuildConnection

func (sq *SqliteAdapter) BuildConnection(ctx context.Context, connParams ConnectionParams) (string, error)

func (*SqliteAdapter) Name

func (sq *SqliteAdapter) Name() string

func (*SqliteAdapter) RunBackup

func (sq *SqliteAdapter) RunBackup(ctx context.Context, conn ConnectionParams, runner Runner, w io.Writer) error

func (*SqliteAdapter) RunRestore

func (sq *SqliteAdapter) RunRestore(ctx context.Context, conn ConnectionParams, runner Runner, r io.Reader) error

func (*SqliteAdapter) SetLogger

func (sq *SqliteAdapter) SetLogger(l *logger.Logger)

func (*SqliteAdapter) TestConnection

func (sq *SqliteAdapter) TestConnection(ctx context.Context, connParams ConnectionParams, runner Runner) error

type TLSConfig

type TLSConfig struct {
	Enabled    bool
	Mode       string
	CACert     string
	ClientCert string
	ClientKey  string
}

Jump to

Keyboard shortcuts

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