Documentation
¶
Index ¶
- Constants
- func CheckMySQLDump() error
- func CompressionExtension(format string) string
- func ResolveCompressionFormat(outputPath, requested string) (string, error)
- func StartSSHTunnel(ctx context.Context, conn *Connection) (func() error, error)
- type Connection
- type DumpOptions
- type DumpResult
- type Dumper
- type Inspector
- type SSHConfig
- type TableInfo
Constants ¶
const ( CompressionAuto = "auto" CompressionNone = "none" CompressionGzip = "gzip" CompressionZstd = "zstd" )
Compression formats supported by dbdump.
Variables ¶
This section is empty.
Functions ¶
func CheckMySQLDump ¶
func CheckMySQLDump() error
CheckMySQLDump verifies that mysqldump is available
func CompressionExtension ¶ added in v1.3.0
func ResolveCompressionFormat ¶ added in v1.3.0
func StartSSHTunnel ¶ added in v1.3.0
func StartSSHTunnel(ctx context.Context, conn *Connection) (func() error, error)
StartSSHTunnel starts an SSH local-forward tunnel and mutates the connection to use the forwarded localhost endpoint.
Types ¶
type Connection ¶
type Connection struct {
Host string
Port int
User string
Password string
Database string
SSH SSHConfig
}
Connection represents a database connection configuration
func (*Connection) Connect ¶
func (c *Connection) Connect() (*sql.DB, error)
Connect establishes a connection to the database
func (*Connection) DSN ¶
func (c *Connection) DSN() string
DSN returns the data source name for MySQL connection Uses mysql.Config for proper escaping and timeout configuration
func (*Connection) TestConnection ¶
func (c *Connection) TestConnection() error
TestConnection tests if the connection is valid
type DumpOptions ¶
type DumpOptions struct {
Connection *Connection
ExcludeTables []string
OutputFile string
DryRun bool
Compression string
}
DumpOptions contains options for dumping the database
type DumpResult ¶
type DumpResult struct {
OutputFile string
Duration time.Duration
ExcludedTables []string
FileSize int64
FileSizeDisplay string
}
DumpResult contains the result of a dump operation
type Dumper ¶
type Dumper struct {
// contains filtered or unexported fields
}
Dumper handles database dumping operations
func (*Dumper) Dump ¶
func (d *Dumper) Dump() (result *DumpResult, err error)
Dump performs the database dump
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
Inspector handles database inspection operations
func (*Inspector) GetAllTablesInfo ¶
GetAllTablesInfo retrieves information for all tables
func (*Inspector) GetTableInfo ¶
GetTableInfo retrieves detailed information about a table
func (*Inspector) ListTables ¶
ListTables returns a list of all tables in the database