postgres

package
v2.9.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(config *Config) *query.Query

NewClient New 新连接

Types

type Config

type Config struct {
	Username      string        //账号 root
	Password      string        //密码
	Host          string        //host localhost
	Port          string        //端口 3306
	Charset       string        //字符编码 utf8mb4
	Database      string        //默认连接数据库
	Local         string        //数据库时区
	MaxOpenConns  int           //连接池最多同时打开的连接数
	MaxIdleConns  int           //连接池里最大空闲连接数。必须要比maxOpenConns小
	MaxLifetime   time.Duration //连接池里面的连接最大存活时长
	MaxIdleTime   time.Duration //连接池里面的连接最大空闲时长
	DriverName    string
	DisableMetric bool // 关闭指标采集
	DisableTrace  bool // 关闭链路追踪
}

Config 数据库配置

func (*Config) URI

func (config *Config) URI() string

URI 构造数据库连接

Jump to

Keyboard shortcuts

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