mysqlDB

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func DBConnect

func DBConnect(DBConnConfigurator DataBaseConnConfigurator) error

func ExecSQL

func ExecSQL(SQL string, Result interface{}, Params ...interface{}) (interface{}, error)

执行SQL语句,返回执行结果(可选) 示例: ExecSQL("CALL SP_GET(?)",&RESULT,Par1,Par2) ExecSQL("select * from test where id=? and c=?",&RESULT,1,"yes") ExecSQL("update test set c="no" where id=? and c=?",nil,1,"yes")

Types

type DataBaseConnConfigurator

type DataBaseConnConfigurator struct {
	DBConnectString           string //连接字符串
	MaxIdleConns              int    //空闲连接池中连接的最大数量
	MaxOpenConns              int    //打开数据库连接的最大数量
	ConnMaxLifetime           int    //连接可复用的最大时间(分钟)
	SlowThreshold             int64  //慢SQL阈值(秒)
	LogLevel                  int    //日志级别 1:Silent  2:Error 3:Warn 4:Info
	IgnoreRecordNotFoundError bool   //忽略ErrRecordNotFound(记录未找到)错误
	Colorful                  bool   //使用彩色打印
}

Jump to

Keyboard shortcuts

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