psqlpkg

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(conf *Config, opts ...gormpkg.Option) (db *gorm.DB, err error)

NewDB 初始化

func NewPostgresDB

func NewPostgresDB(conf *Config, opts ...gormpkg.Option) (db *gorm.DB, err error)

NewPostgresDB .

Types

type Config

type Config struct {
	Dsn string
	// SlowThreshold 慢查询
	SlowThreshold  *durationpb.Duration
	LoggerEnable   bool
	LoggerColorful bool
	// LoggerLevel 日志级别;值:DEBUG、INFO、WARN、ERROR、FATAL
	LoggerLevel string
	// ConnMaxActive 连接可复用的最大时间
	ConnMaxActive uint32
	// ConnMaxLifetime 可复用的最大时间
	ConnMaxLifetime *durationpb.Duration
	// ConnMaxIdle 连接池中空闲连接的最大数量
	ConnMaxIdle uint32
	// ConnMaxIdleTime 设置连接空闲的最长时间
	ConnMaxIdleTime *durationpb.Duration
}

Config postgres conig

Jump to

Keyboard shortcuts

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