database

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MYSQLDUMP_PHP_VERSION = "2.11"

Variables

This section is empty.

Functions

func MysqlCliCredentials

func MysqlCliCredentials(credentials DatabaseCredentials) string

Types

type DatabaseCredentials

type DatabaseCredentials struct {
	User string
	Pass string
	Name string
	Host string
}

type DatabaseExporter

type DatabaseExporter interface {
	Export() (io.Reader, error)
}

func NewDatabaseExporter

NewDatabaseExporter is a factory function that returns a DatabaseExporter. It detects at runtime whether the remote server supports `mysqldump` or not, and returns the appropriate exporter.

type HttpGetter

type HttpGetter interface {
	Get(url string) (resp io.ReadCloser, err error)
}

type MysqldumpDatabaseExporter

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

MysqldumpDatabaseExporter is a DatabaseExporter that uses the mysqldump command to export the database. It should be the preferred exporter whenever possible.

func (*MysqldumpDatabaseExporter) Export

func (e *MysqldumpDatabaseExporter) Export() (io.Reader, error)

type PHPDatabaseExporter

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

PHPDatabaseExporter is a DatabaseExporter that uses a custom PHP script to export the database. It should only be used as a fallback when the mysqldump command is not available. The script we utilize is bundled with this package to lock its version and ensure that it is always available. It's source can be found here: https://github.com/ifsnop/mysqldump-php

func (*PHPDatabaseExporter) Export

func (e *PHPDatabaseExporter) Export() (io.Reader, error)

Export We need to upload the PHP script to the server, then run it to generate the database dump.

Jump to

Keyboard shortcuts

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