sql

package
v0.0.0-...-40b14aa Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RelayDatabase Database global variable database `relay`
	RelayDatabase = &gorm.DB{}
)

Functions

func CloseConnection

func CloseConnection(db *gorm.DB) error

CloseConnection close connection db

func DebugRelayDatabase

func DebugRelayDatabase()

DebugRelayDatabase set debug sql

func Migration

func Migration(db *gorm.DB) error

Types

type Configuration

type Configuration struct {
	Host         string
	Port         int
	Username     string
	Password     string
	DatabaseName string
	MaxIdleConns int
	MaxOpenConns int
	MaxLifetime  time.Duration
}

Configuration config mysql

type Session

type Session struct {
	Database *gorm.DB
	Conn     *sql.DB
}

Session session

func InitConnection

func InitConnection(cf *Configuration) (*Session, error)

InitConnectionMysql open initialize a new db connection.

Jump to

Keyboard shortcuts

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