db_shell_cmd

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd() *cobra.Command

Cmd returns the db-shell command.

Types

type DBConfig

type DBConfig struct {
	Driver   string `yaml:"driver"`
	DSN      string `yaml:"dsn"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Name     string `yaml:"name"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	SSLMode  string `yaml:"sslmode"`
}

type EnvironmentLookup

type EnvironmentLookup func(string) string

type ExecutionResult

type ExecutionResult struct {
	Columns      []string
	Rows         [][]string
	RowsAffected int64
	IsQuery      bool
}

type Executor

type Executor interface {
	Execute(context.Context, string) (ExecutionResult, error)
	Close() error
	Summary() string
}

func OpenExecutor

func OpenExecutor(ctx context.Context, cfg ResolvedConfig) (Executor, error)

type Options

type Options struct {
	Driver   string
	DSN      string
	Host     string
	Port     int
	Name     string
	User     string
	Password string
	SSLMode  string
}

type ResolvedConfig

type ResolvedConfig struct {
	Driver   string
	DSN      string
	Host     string
	Port     int
	Name     string
	User     string
	Password string
	SSLMode  string
}

func ResolveConfig

func ResolveConfig(opts Options, configPath, envPath string, envLookup EnvironmentLookup) (ResolvedConfig, error)

func (ResolvedConfig) IsSQLite

func (c ResolvedConfig) IsSQLite() bool

func (ResolvedConfig) SQLDriverName

func (c ResolvedConfig) SQLDriverName() string

func (ResolvedConfig) SafeSummary

func (c ResolvedConfig) SafeSummary() string

type Shell

type Shell struct {
	Executor Executor
	In       io.Reader
	Out      io.Writer
	ErrOut   io.Writer
	Prompt   string
}

func (Shell) Run

func (s Shell) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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