database

package
v1.1.32 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MySQLConnect

func MySQLConnect(config *DBConfig) (*gorm.DB, error)

MySQLConnect connects to a MySQL database

Types

type DBConfig

type DBConfig struct {
	Host     string `default:"127.0.0.1" json:"host"`
	Database string `required:"true" json:"database"`
	User     string `default:"root" json:"user"`
	Password string `required:"true" env:"MysqlPassword"`
	Port     uint   `default:"3306" json:"port"`
}

func LoadMySQLConfig

func LoadMySQLConfig(configFiles ...string) (*DBConfig, error)

LoadMySQLConfig returns the mysql connection config

func (*DBConfig) MySqlDSN

func (dc *DBConfig) MySqlDSN() string

MySqlDSN returns the connection string for MySQL

Jump to

Keyboard shortcuts

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