config

package
v0.34.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init added in v0.7.0

func Init(configName string) (command.Options, error)

Init reads in config file and returns a commands/Options instance.

func SetupKeybindings added in v0.34.0

func SetupKeybindings() (command.TUIKeyBindings, error)

Types

type Config

type Config struct {
	Database []Database
	User     string
	Pswd     string
	Host     string
	Port     string
	DBName   string
	Driver   string
	Limit    uint `fig:"limit" default:"100"`
}

Config struct is used to store the db connection data.

func Get

func Get() *Config

Get returns a config object with the db connection data already in place.

func New added in v0.13.0

func New(cmd *cobra.Command) *Config

New returns a config instance the with db connection data inplace based on the flags of a cobra command.

func (*Config) GetDBConnStr

func (c *Config) GetDBConnStr() string

GetDBConnStr returns the connection string.

func (*Config) GetSQLXDBConnStr added in v0.2.0

func (c *Config) GetSQLXDBConnStr() string

GetSQLXDBConnStr returns the connection string.

func (*Config) MigrateInstance added in v0.13.0

func (c *Config) MigrateInstance() (*migrate.Migrate, error)

MigrateInstance returns a migrate instance based on the given driver.

func (*Config) Open added in v0.13.0

func (c *Config) Open() (*sql.DB, error)

Open returns a db connection using the data from the config object.

type Database added in v0.18.0

type Database struct {
	Name string `fig:"name"`

	Host     string
	Port     string
	DB       string `validate:"required"`
	User     string
	Password string
	Driver   string `validate:"required"`
	Schema   string

	// SSH Tunnel.
	SSHHost          string `fig:"ssh-host"`
	SSHPort          string `fig:"ssh-port"`
	SSHUser          string `fig:"ssh-user"`
	SSHPass          string `fig:"ssh-pass"`
	SSHKeyFile       string `fig:"ssh-key-file"`
	SSHKeyPassphrase string `fig:"ssh-key-pass"`

	// SSL connection params.
	SSL string `default:"disable"`

	SSLCert     string `fig:"sslcert"`
	SSLKey      string `fig:"sslkey"`
	SSLPassword string `fig:"sslpassword"`
	SSLRootcert string `fig:"sslrootcert"`

	// oracle specific.
	TraceFile string `fig:"trace"`
	SSLVerify string `fig:"ssl-verify"`
	Wallet    string `fig:"wallet"`

	// sql server.
	Encrypt                string `fig:"encrypt"`
	TrustServerCertificate string `fig:"trust-server-certificate"`
	ConnectionTimeout      string `fig:"connection-timeout"`
}

type KeyBindings added in v0.32.0

type KeyBindings struct {
	RunQuery    string `fig:"run-query"    default:"Ctrl-Space"`
	Structure   string `fig:"structure"    default:"Ctrl-S"`
	Indexes     string `fig:"indexes"      default:"Ctrl-I"`
	Constraints string `fig:"constraints"  default:"Ctrl-T"`
	ClearEditor string `fig:"clear-editor" default:"Ctrl-D"`
	Navigation  NavigationBindgins
}

type KeyBindingsConfig added in v0.34.0

type KeyBindingsConfig struct {
	KeyBindings KeyBindings
}
type NavigationBindgins struct {
	Up    string `fig:"up"    default:"Ctrl-K"`
	Down  string `fig:"down"  default:"Ctrl-J"`
	Left  string `fig:"left"  default:"Ctrl-H"`
	Right string `fig:"right" default:"Ctrl-L"`
}

Jump to

Keyboard shortcuts

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