psqlpkg

package
v0.3.32 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 4

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