gormsql

package
v0.0.0-...-bda00f0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GormMysql

func GormMysql(c GORMConf) (*gorm.DB, error)

func GormPgSql

func GormPgSql(c GORMConf) (*gorm.DB, error)

Types

type GORMConf

type GORMConf struct {
	Type        string `json:"Type"`        // type of database: mysql, postgres
	Host        string `json:"Host"`        // address
	Port        int    `json:"Port"`        // port
	Config      string `json:"Config"`      // extra config such as charset=utf8mb4&parseTime=True
	DbName      string `json:"DBName"`      // database name
	Username    string `json:"Username"`    // username
	Password    string `json:"Password"`    // password
	MaxIdleConn int    `json:"MaxIdleConn"` // the maximum number of connections in the idle connection pool
	MaxOpenConn int    `json:"MaxOpenConn"` // the maximum number of open connections to the database
	LogMode     string `json:"LogMode"`     // open gorm's global logger
}

func (GORMConf) MysqlDSN

func (g GORMConf) MysqlDSN() string

func (GORMConf) NewGORM

func (g GORMConf) NewGORM() (*gorm.DB, error)

func (GORMConf) PostgresDSN

func (g GORMConf) PostgresDSN() string

Jump to

Keyboard shortcuts

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