persistence

package
v2.0.65+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2016 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//PGDmpDropCmd - command to drop a psql schema
	PGDmpDropCmd = "drop schema public cascade;"
	//PGDmpCreateCmd - create schema psql command
	PGDmpCreateCmd = "create schema public;"

	//MySQLDmpConnectCmd --
	MySQLDmpConnectCmd = "%s -u %s -h %s --password=%s"
	//MySQLDmpCreateCmd --
	MySQLDmpCreateCmd = "%s < %s"
	//MySQLDmpFlushCmd --
	MySQLDmpFlushCmd = "%s > flush privileges"
	//MySQLDmpDumpCmd --
	MySQLDmpDumpCmd = "%s --all-databases"
)

Variables

View Source
var (
	//PGDmpDumpBin - location of pg_dump binary
	PGDmpDumpBin = "/var/vcap/packages/postgres/bin/pg_dump"
	//PGDmpRestoreBin - location of pg_restore binary
	PGDmpRestoreBin = "/var/vcap/packages/postgres/bin/pg_restore"

	//MySQLDmpDumpBin --
	MySQLDmpDumpBin = "/var/vcap/packages/mariadb/bin/mysqldump"
	//MySQLDmpSQLBin --
	MySQLDmpSQLBin = "/var/vcap/packages/mariadb/bin/mysql"
)

Functions

This section is empty.

Types

type MysqlDump

type MysqlDump struct {
	IP         string
	Username   string
	Password   string
	DbFile     string
	ConfigFile string
	Caller     command.Executer
	RemoteOps  remoteOperationsInterface
}

MysqlDump - an object which can handle mysql dumps

func NewMysqlDump

func NewMysqlDump(ip, username, password string) *MysqlDump

NewMysqlDump - will initialize a mysqldump for local execution

func NewRemoteMysqlDump

func NewRemoteMysqlDump(username, password string, sshCfg command.SshConfig) (*MysqlDump, error)

NewRemoteMysqlDump - will initialize a mysqldmp for remote execution

func (*MysqlDump) Dump

func (s *MysqlDump) Dump(dest io.Writer) (err error)

Dump - will dump a mysql to the given writer

func (*MysqlDump) Import

func (s *MysqlDump) Import(lfile io.Reader) (err error)

Import - will import to mysql from the given reader

type PgDump

type PgDump struct {
	IP        string
	Port      int
	Database  string
	Username  string
	Password  string
	DbFile    string
	Caller    command.Executer
	RemoteOps remoteOperationsInterface
	// contains filtered or unexported fields
}

PgDump - an object which can handle pgres dumps

func NewPgDump

func NewPgDump(ip string, port int, database, username, password string) *PgDump

NewPgDump - a pgdump object initialized for local fs

func NewPgRemoteDump

func NewPgRemoteDump(port int, database, username, password string, sshCfg command.SshConfig) (*PgDump, error)

NewPgRemoteDump - a pgdump initialized for remote fs

func (*PgDump) Dump

func (s *PgDump) Dump(dest io.Writer) (err error)

Dump - allows us to create a backup and pipe it to the given writer

func (*PgDump) Import

func (s *PgDump) Import(lfile io.Reader) (err error)

Import - allows us to import a pgdmp file in the form of a reader

Jump to

Keyboard shortcuts

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