db

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

GetDB returns *gorm.DB for db operation.

func GetSQL

func GetSQL(name string) string

GetSQL gets a stored sql string by name.

func InitConnection

func InitConnection(dialect string, args ...interface{}) error

InitConnection initializes db connection.

func Query

func Query(work func(sql *gorm.DB) error) error

Query does a db query.

func Reconnect

func Reconnect() error

Reconnect tries to reconnect to db.

func RegisterSQL

func RegisterSQL(name string, sql string)

RegisterSQL registers a sql string in memory.

func SetConfig

func SetConfig(maxIdleConns int, maxOpenConns int, connMaxLifetime time.Duration)

SetConfig sets configuration of connection pool.

func Transaction

func Transaction(work func(tx *gorm.DB) error) error

Transaction does a db transaction.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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