pgrestore

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Custom
	DirPath string

	// General options:
	DbName   string `mapstructure:"dbname"`
	FileName string `mapstructure:"file"` // --file=FILENAME
	Format   string // Supports only directory format
	List     bool   `mapstructure:"list"`
	Verbose  bool   `mapstructure:"verbose"`
	Version  bool   `mapstructure:"version"`

	// Options controlling the output content
	DataOnly                   bool     `mapstructure:"data-only"`
	Clean                      bool     `mapstructure:"clean"`
	Create                     bool     `mapstructure:"create"`
	ExitOnError                bool     `mapstructure:"exit-on-error"`
	Index                      []string `mapstructure:"index"`
	Jobs                       int      `mapstructure:"jobs"`
	UseList                    string   `mapstructure:"use-list"`
	ListFormat                 string   `mapstructure:"list-format"`
	Schema                     []string `mapstructure:"schema"`
	ExcludeSchema              []string `mapstructure:"exclude-schema"`
	NoOwner                    bool     `mapstructure:"no-owner"`
	Function                   []string `mapstructure:"function"`
	SchemaOnly                 bool     `mapstructure:"schema-only"`
	SuperUser                  string   `mapstructure:"superuser"`
	Table                      []string `mapstructure:"table"`
	Trigger                    []string `mapstructure:"trigger"`
	NoPrivileges               bool     `mapstructure:"no-privileges"`
	SingleTransaction          bool     `mapstructure:"single-transaction"`
	DisableTriggers            bool     `mapstructure:"disable-triggers"`
	EnableRowSecurity          bool     `mapstructure:"enable-row-security"`
	IfExists                   bool     `mapstructure:"if-exists"`
	NoComments                 bool     `mapstructure:"no-comments"`
	NoDataForFailedTables      bool     `mapstructure:"no-data-for-failed-tables"`
	NoPublications             bool     `mapstructure:"no-publications"`
	NoSecurityLabels           bool     `mapstructure:"no-security-labels"`
	NoSubscriptions            bool     `mapstructure:"no-subscriptions"`
	NoTableAccessMethod        bool     `mapstructure:"no-table-access-method"`
	NoTableSpaces              bool     `mapstructure:"no-tablespaces"`
	Section                    string   `mapstructure:"section"`
	StrictNames                bool     `mapstructure:"strict-names"`
	UseSetSessionAuthorization bool     `mapstructure:"use-set-session-authorization"`

	// Connection options:
	Host       string `mapstructure:"host"`
	Port       int    `mapstructure:"port"`
	UserName   string `mapstructure:"username"`
	NoPassword bool   `mapstructure:"no-password"`
	Password   bool   `mapstructure:"password"`
	Role       string `mapstructure:"role"`
}

func (*Options) GetParams

func (o *Options) GetParams() []string

func (*Options) GetPgDSN

func (o *Options) GetPgDSN() (string, error)

type PgRestore

type PgRestore struct {
	BinPath string
}

func NewPgRestore

func NewPgRestore(binPath string) *PgRestore

func (*PgRestore) Run

func (pr *PgRestore) Run(ctx context.Context, options *Options) error

type Script

type Script struct {
	Name      string   `mapstructure:"name"`
	When      string   `mapstructure:"when"`
	Query     string   `mapstructure:"query"`
	QueryFile string   `mapstructure:"query_file"`
	Command   []string `mapstructure:"command"`
}

func (*Script) Execute

func (s *Script) Execute(ctx context.Context, tx pgx.Tx) error

func (*Script) ExecuteCommand

func (s *Script) ExecuteCommand(ctx context.Context) error

func (*Script) ExecuteQuery

func (s *Script) ExecuteQuery(ctx context.Context, tx pgx.Tx) error

func (*Script) ExecuteQueryFile

func (s *Script) ExecuteQueryFile(ctx context.Context, tx pgx.Tx) error

Jump to

Keyboard shortcuts

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