gormcli

package
v0.0.0-...-c42b9c9 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package gormcli 用于管理mysql连接

Index

Constants

View Source
const (
	DEFAULT_MAX_CONN      = 12000
	DEFAULT_MAX_IDEL_CONN = 7000
	DEFAULT_IDEL_TIMEOUT  = 10 // use time.Second
	DEFAULT_READ_TIMEOUT  = 10
	DEFAULT_WRITE_TIMEOUT = 10
)
View Source
const (
	GormDuplicateErrKey = "Duplicate entry"
)

Variables

This section is empty.

Functions

func IsDupErr

func IsDupErr(err error) bool

judge err dup

Types

type GormFactory

type GormFactory struct {
	MaxIdleConn  int
	MaxConn      int
	IdleTimeout  int
	ReadTimeout  int
	WriteTimeout int
}

GormFactory 用来生成Gorm指针的工厂

var (
	Factory GormFactory
)

func (*GormFactory) CreateGorm

func (p *GormFactory) CreateGorm(user, pwd, url, database string) (*gorm.DB, error)

url like this : "127.0.0.1:3306"

type GormLogger

type GormLogger struct {
}

GormLogger Gorm用来打日志的结构体

func (*GormLogger) Print

func (logger *GormLogger) Print(values ...interface{})

实现logger的print函数

Jump to

Keyboard shortcuts

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