databasex

package
v0.0.0-...-a5c60e6 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewDB

func NewDB(config *Config) (*sql.DB, error)

func NewDBs

func NewDBs(configs Configs) (map[string]*sql.DB, error)

func NewGormDB

func NewGormDB(config *Config) (*gorm.DB, error)

func NewGormDBs

func NewGormDBs(configs Configs) (map[string]*gorm.DB, error)

func NewSqlxDB

func NewSqlxDB(config *Config) (*sqlx.DB, error)

func NewSqlxDBs

func NewSqlxDBs(configs Configs) (map[string]*sqlx.DB, error)

Types

type Config

type Config struct {
	DriverName string        `mapstructure:"driver_name" json:"driver_name" yaml:"driver_name"`
	DSN        string        `mapstructure:"dsn" json:"dsn" yaml:"dsn"`
	Timeout    time.Duration `mapstructure:"timeout" json:"timeout" yaml:"timeout"`
}

type Configs

type Configs map[string]*Config

Jump to

Keyboard shortcuts

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