config

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 15 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.

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
	Host     string
	Port     string
	DB       string `validate:"required"`
	User     string
	Password string
	Driver   string `validate:"required"`
	Schema   string
	// SSL connection params.
	SSL         string `default:"disable"`
	SSLCert     string `fig:"sslcert"`
	SSLKey      string `fig:"sslkey"`
	SSLPassword string `fig:"sslpassword"`
	SSLRootcert string `fig:"sslrootcert"`
}

Jump to

Keyboard shortcuts

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