config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingJobName  = errors.New("job name is required")
	ErrMissingDBDsn    = errors.New("databse dsn is required")
	ErrMissingDBDriver = errors.New("databse driver is required")
)

Functions

This section is empty.

Types

type Dump

type Dump struct {
	Jobs []*Job `yaml:"jobs"`
}

func (*Dump) Validate

func (dump *Dump) Validate() error

type Job

type Job struct {
	Name        string   `yaml:"name"`
	DBDriver    string   `yaml:"dbdriver"`
	DBDsn       string   `yaml:"dbdsn"`
	Gzip        bool     `yaml:"gzip"`
	Unique      bool     `yaml:"unique"`
	SshHost     string   `yaml:"sshhost"`
	SshUser     string   `yaml:"sshuser"`
	SshKey      string   `yaml:"sshkey"`
	DumpOptions []string `yaml:"options"`
	Storage     struct {
		Local   []*local.Local     `yaml:"local"`
		S3      []*s3.S3           `yaml:"s3"`
		GDrive  []*gdrive.GDrive   `yaml:"gdrive"`
		Dropbox []*dropbox.Dropbox `yaml:"dropbox"`
	} `yaml:"storage"`
}

func NewJob

func NewJob(name, driver, dbDsn string, opts ...Option) *Job

func (*Job) GetDBDriver

func (job *Job) GetDBDriver() (driver.Driver, error)

func (*Job) GetStorages

func (job *Job) GetStorages() []Storage

func (*Job) ViaSsh

func (job *Job) ViaSsh() bool

type JobResult

type JobResult struct {
	Error   error
	JobName string
	Elapsed time.Duration
}

func (*JobResult) String

func (result *JobResult) String() string

type MultiCloser

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

func NewMultiCloser

func NewMultiCloser(closers []io.Closer) *MultiCloser

func (*MultiCloser) Close

func (m *MultiCloser) Close() error

type Option

type Option func(job *Job)

func WithDumpOptions

func WithDumpOptions(dumpOptions ...string) Option

func WithGzip

func WithGzip(gzip bool) Option

func WithSshHost

func WithSshHost(sshHost string) Option

func WithSshKey

func WithSshKey(sshKey string) Option

func WithSshUser

func WithSshUser(sshUser string) Option

type Storage

type Storage interface {
	Save(reader io.Reader, gzip bool, unique bool) error
}

Jump to

Keyboard shortcuts

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