dsnexec

package
v0.0.0-...-71be670 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Command string   `yaml:"command"`
	Args    []string `yaml:"args,omitempty"`
}

Command is a command to execute

type Config

type Config struct {
	Sources     map[string]DBConnInfo `yaml:"sources"`
	Destination DBConnInfo            `yaml:"destination"`
	Commands    []Command             `yaml:"commands,omitempty"`
}

Config is the configuration for the dsnexec

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the config

type DBConnInfo

type DBConnInfo struct {
	Driver string `yaml:"driver"`
	DSN    string `yaml:"dsn,omitempty"`
}

DBConnInfo is a database connection info

func (DBConnInfo) Validate

func (c DBConnInfo) Validate() error

Validate validates the db conn info

type Handler

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

Hanlder is an instance of dsnexec.

func NewHanlder

func NewHanlder(options ...HandlerOption) (*Handler, error)

NewHanlder creates a new dsnexec handler.

func (*Handler) Exec

func (w *Handler) Exec() error

Exec executes the commands in the config given the current state of the sources.

func (*Handler) UpdateDSN

func (w *Handler) UpdateDSN(path, content string) error

UpdateDSN updates the dsn for a source.

type HandlerOption

type HandlerOption func(*Handler) error

HandlerOption is an option for the dsnexec handler.

func WithConfig

func WithConfig(c Config) HandlerOption

WithConfig sets the config for the dnsexec handler.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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