database

package
v0.0.0-...-2740610 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB(db *gorm.DB) error

CloseDB close the db handler. notice the db handler only can close when then program exit.

func InitDB

func InitDB(config *Config) (*gorm.DB, error)

InitDB init the db handler

func Ping

func Ping(db *gorm.DB) (*sql.DB, error)

Ping check db status

Types

type Config

type Config struct {
	// data source name
	DSN        string `json:"dsn"`
	DriverName string `json:"driverName"`

	MaxOpenNum int `json:"maxOpenNum"`
	MaxIdleNum int `json:"maxIdleNum"`
}

Config db config

Jump to

Keyboard shortcuts

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