config

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 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() (command.Options, error)

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

Types

type Config

type Config struct {
	Database struct {
		Host     string
		Port     string
		DB       string `validate:"required"`
		User     string
		Password string
		Driver   string `validate:"required"`
		SSL      string `default:"disable"`
	}
	User   string
	Pswd   string
	Host   string
	Port   string
	DBName string
	Driver string
	Limit  int `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.

Jump to

Keyboard shortcuts

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