Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v0.19.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverPostgres = "postgres"
	DriverMySQL    = "mysql"
	DriverSQLite   = "sqlite"
)

Variables

View Source
var (
	ErrUnknownDriver = errors.New("unknown driver")
)

Functions

This section is empty.

Types

type Config added in v0.19.2

type Config struct {
	Driver      string `mapstructure:"dbDriver" envVar:"ATMK_DB_DRIVER"`
	Host        string `mapstructure:"dbHost" envVar:"ATMK_DB_HOST"`
	Port        string `mapstructure:"dbPort" envVar:"ATMK_DB_PORT"`
	User        string `mapstructure:"dbUser" envVar:"ATMK_DB_USER"`
	Pass        string `mapstructure:"dbPass" envVar:"ATMK_DB_PASS"`
	Name        string `mapstructure:"dbName" envVar:"ATMK_DB_NAME"`
	Schema      string `mapstructure:"dbSchema" envVar:"ATMK_DB_SCHEMA"`
	SSL         bool   `mapstructure:"dbSSL" envVar:"ATMK_DB_SSL"`
	PingTimeout int    `mapstructure:"dbPingTimeout" envVar:"ATMK_DB_TIMEOUT"`
}

func Configure added in v0.19.2

func Configure(key ...string) (*Config, error)

func Defaults added in v0.19.2

func Defaults() *Config

type DB added in v0.19.2

type DB interface {
	Connect() (*sql.DB, error)
	Ping() error
}

func New

func New(cfg *Config) (DB, error)

type MysqlDB added in v0.19.2

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

func (*MysqlDB) Connect added in v0.19.2

func (mysqlDB *MysqlDB) Connect() (*sql.DB, error)

func (*MysqlDB) Ping added in v0.19.2

func (mysqlDB *MysqlDB) Ping() error

type PostgresDB added in v0.19.2

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

func (*PostgresDB) Connect added in v0.19.2

func (postgresDB *PostgresDB) Connect() (*sql.DB, error)

func (*PostgresDB) Ping added in v0.19.2

func (postgresDB *PostgresDB) Ping() error

type SqliteDB added in v0.19.2

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

func (*SqliteDB) Connect added in v0.19.2

func (sqlLite *SqliteDB) Connect() (*sql.DB, error)

func (*SqliteDB) Ping added in v0.19.2

func (sqlLite *SqliteDB) Ping() error

Jump to

Keyboard shortcuts

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