pgdump

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoneActionStage = iota
	StartedActionStage
	EndedActionStage
)

Variables

This section is empty.

Functions

func AdaptRegexp

func AdaptRegexp(data string) (string, error)

func DoubleQuoteState

func DoubleQuoteState(actx *ActionContext, s string, dest *strings.Builder) error

func KeepCaseState

func KeepCaseState(actx *ActionContext, s string, dest *strings.Builder) error

func LowerCaseState

func LowerCaseState(actx *ActionContext, s string, dest *strings.Builder) error

func QuestionMarkState

func QuestionMarkState(actx *ActionContext, s string, dest *strings.Builder) error

func WildCardState

func WildCardState(actx *ActionContext, s string, dest *strings.Builder) error

Types

type Action

type Action func(actx *ActionContext, s string, dest *strings.Builder) error

type ActionContext

type ActionContext struct {
	strings.Builder
	Stage int
}

func (*ActionContext) IsDone

func (ac *ActionContext) IsDone() bool

func (*ActionContext) SetDone

func (ac *ActionContext) SetDone()

type Options

type Options struct {
	// General options:
	FileName        string `mapstructure:"file"` // --file=FILENAME
	Format          string // Supports only directory format
	Jobs            int    `mapstructure:"jobs"`
	Verbose         bool   `mapstructure:"verbose"`
	Compression     int    `mapstructure:"compress"`
	LockWaitTimeout int    `mapstructure:"lock-wait-timeout"`
	NoSync          bool   `mapstructure:"no-sync"`

	// Options controlling the output content
	DataOnly                   bool     `mapstructure:"data-only"`
	Blobs                      bool     `mapstructure:"blobs"`
	NoBlobs                    bool     `mapstructure:"no-blobs"`
	Clean                      bool     `mapstructure:"clean"`
	Create                     bool     `mapstructure:"create"`
	Extension                  []string `mapstructure:"extension"`
	Encoding                   string   `mapstructure:"encoding"`
	Schema                     []string `mapstructure:"schema"`
	ExcludeSchema              []string `mapstructure:"exclude-schema"`
	NoOwner                    bool     `mapstructure:"no-owner"`
	SchemaOnly                 bool     `mapstructure:"schema-only"`
	SuperUser                  string   `mapstructure:"superuser"`
	Table                      []string `mapstructure:"table"`
	ExcludeTable               []string `mapstructure:"exclude-table"`
	NoPrivileges               bool     `mapstructure:"no-privileges"`
	DisableDollarQuoting       bool     `mapstructure:"disable-dollar-quoting"`
	DisableTriggers            bool     `mapstructure:"disable-triggers"`
	EnableRowSecurity          bool     `mapstructure:"enable-row-security"`
	ExcludeTableData           []string `mapstructure:"exclude-table-data"`
	ExtraFloatDigits           string   `mapstructure:"extra-float-digits"`
	IfExists                   bool     `mapstructure:"if-exists"`
	IncludeForeignData         []string `mapstructure:"include-foreign-data"`
	LoadViaPartitionRoot       bool     `mapstructure:"load-via-partition-root"`
	NoComments                 bool     `mapstructure:"no-comments"`
	NoPublications             bool     `mapstructure:"no-publications"`
	NoSecurityLabels           bool     `mapstructure:"no-security-labels"`
	NoSubscriptions            bool     `mapstructure:"no-subscriptions"`
	NoSynchronizedSnapshots    bool     `mapstructure:"no-synchronized-snapshots"`
	NoTableSpaces              bool     `mapstructure:"no-tablespaces"`
	NoToastCompression         bool     `mapstructure:"no-toast-compression"`
	NoUnloggedTableData        bool     `mapstructure:"no-unlogged-table-data"`
	OnConflictDoNothing        bool     `mapstructure:"on-conflict-do-nothing"`
	QuoteAllIdentifiers        bool     `mapstructure:"quote-all-identifiers"`
	Section                    string   `mapstructure:"section"`
	SerializableDeferrable     bool     `mapstructure:"serializable-deferrable"`
	Snapshot                   string   `mapstructure:"snapshot"`
	StrictNames                bool     `mapstructure:"strict-names"`
	UseSetSessionAuthorization bool     `mapstructure:"use-set-session-authorization"`

	// Connection options:
	DbName     string `mapstructure:"dbname"`
	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 ParserContext

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

func NewParser

func NewParser() *ParserContext

func (*ParserContext) Depth

func (p *ParserContext) Depth() int

func (*ParserContext) PopState

func (p *ParserContext) PopState()

func (*ParserContext) PushState

func (p *ParserContext) PushState(state *State)

type PgDump

type PgDump struct {
	BinPath string
}

func NewPgDump

func NewPgDump(binPath string) *PgDump

func (*PgDump) Run

func (pd *PgDump) Run(ctx context.Context, options *Options) error

type State

type State struct {
	ActionContext
	Name   StateName
	Action Action
}

type StateName

type StateName string
var (
	StateLowerCase     StateName = "StateLowerCase"
	StateKeepCase      StateName = "StateKeepCase"
	StateWildcard      StateName = "StateWildcard"
	StateDoubledQuotes StateName = "StateDoubledQuotes"
	StateQuestionMark  StateName = "StateQuestionMark"
	DefaultState                 = &State{
		Name:   StateLowerCase,
		Action: LowerCaseState,
	}
)

Jump to

Keyboard shortcuts

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