gorm

package
v0.0.0-...-0871eb3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(host, dbname, user, pass string, port uint16) error

New is for create instance

Types

type GR

type GR struct {
	DB         *gorm.DB
	ServerInfo //embeded
}

GR is for database information and gorm instance

func GetDB

func GetDB() *GR

GetDB is to get instance. singleton architecture

func (*GR) Close

func (gr *GR) Close()

Close is to close connection

func (*GR) Connection

func (gr *GR) Connection() (*gorm.DB, error)

Connection is to connect to MySQL server Be careful, sql.Open() doesn't return err. Use db.Ping() to check DB condition.

type ServerInfo

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

ServerInfo is for database information

Jump to

Keyboard shortcuts

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