database

package
v0.0.0-...-219e97f Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB             *DBModel
	POSGRES_CONFIG = "user=%s password=%s dbname=%s host=%s port=%s sslmode=%s"
	MYSQL_CONFIG   = "%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local"
)

Functions

func NewGen

func NewGen(db *gorm.DB, path string, fc interface{}, models ...interface{})

func NewMigration

func NewMigration(models ...interface{}) error

Types

type DBModel

type DBModel struct {
	ServerMode   string `config:"server_mode"`
	Driver       string `config:"db_driver"`
	Host         string `config:"db_host"`
	Port         string `config:"db_port"`
	Name         string `config:"db_name"`
	Username     string `config:"db_username"`
	Password     string `config:"db_password"`
	MaxIdleConn  int    `config:"conn_idle"`
	MaxOpenConn  int    `config:"conn_max"`
	ConnLifeTime int    `config:"conn_lifetime"`
}

func (*DBModel) OpenDB

func (c *DBModel) OpenDB() (*gorm.DB, *error)

Jump to

Keyboard shortcuts

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