pgctl

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPubName = "dbc_temp_pub_for_upgrade"
	DefaultSubName = "dbc_temp_sub_for_upgrade"
)

Variables

View Source
var (
	PGDump              = "pg_dump"
	PGDumpOpts          = []string{}
	PGDumpDefaultFormat = "p"
)
View Source
var (
	PSQL           = "psql"
	PGDRestoreOpts = []string{}
)

Functions

func Exec

func Exec(name string, arg ...string) (string, error)

Types

type Config

type Config struct {
	Log              logr.Logger
	SourceDBAdminDsn string
	SourceDBUserDsn  string
	TargetDBAdminDsn string
	TargetDBUserDsn  string
	ExportFilePath   string
}

type Dump

type Dump struct {
	DsnUri  string
	Verbose bool
	Path    string
	Format  *string
	Options []string
	// contains filtered or unexported fields
}

func NewDump

func NewDump(DsnUri string) *Dump

func (*Dump) EnableVerbose

func (x *Dump) EnableVerbose()

func (*Dump) Exec

func (x *Dump) Exec(opts ExecOptions) Result

func (*Dump) GetFileName

func (x *Dump) GetFileName() string

func (*Dump) GetOptions

func (x *Dump) GetOptions() []string

func (*Dump) ResetOptions

func (x *Dump) ResetOptions()

func (*Dump) SetFileName

func (x *Dump) SetFileName(filename string)

func (*Dump) SetOptions

func (x *Dump) SetOptions(o []string)

func (*Dump) SetPath

func (x *Dump) SetPath(path string)

func (*Dump) SetupFormat

func (x *Dump) SetupFormat(f string)

type ExecOptions

type ExecOptions struct {
	StreamPrint bool
}

type ExportFile

type ExportFile struct {
	Path string
	Name string
}

type Restore

type Restore struct {
	DsnUri  string
	Verbose bool
	Path    string
	Options []string
	Schemas []string
}

func NewRestore

func NewRestore(DsnUri string) *Restore

func (*Restore) EnableVerbose

func (x *Restore) EnableVerbose()

func (*Restore) Exec

func (x *Restore) Exec(filename string, opts ExecOptions) Result

func (*Restore) GetOptions

func (x *Restore) GetOptions() []string

func (*Restore) ResetOptions

func (x *Restore) ResetOptions()

func (*Restore) SetOptions

func (x *Restore) SetOptions(o []string)

func (*Restore) SetPath

func (x *Restore) SetPath(path string)

func (*Restore) SetSchemas

func (x *Restore) SetSchemas(schemas []string)

type Result

type Result struct {
	Mine        string
	FileName    string
	Output      string
	Error       *ResultError
	FullCommand string
}

type ResultError

type ResultError struct {
	Err       error
	CmdOutput string
	ExitCode  int
}

type Results

type Results struct {
	Dump    Result
	Restore Result
}

type State

type State interface {
	Execute() (State, error)
	Id() StateEnum
	String() string
}

func GetReplicatorState

func GetReplicatorState(name string, c Config) (State, error)

type StateEnum

type StateEnum int
const (
	S_Initial StateEnum = iota
	S_ValidateConnection
	S_CreatePublication
	S_CopySchema
	S_CreateSubscription
	S_EnableSubscription
	S_CutOverReadinessCheck
	S_ResetTargetSequence
	S_RerouteTargetSecret
	S_WaitToDisableSource
	S_DisableSourceAccess
	S_ValidateMigrationStatus
	S_DisableSubscription
	S_DeleteSubscription
	S_DeletePublication
	S_Completed
	S_Retry
)

func GetStateEnum

func GetStateEnum(name string) (StateEnum, error)

func (StateEnum) String

func (s StateEnum) String() string

Jump to

Keyboard shortcuts

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