mysql

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DuplicateEntry added in v0.4.1

func DuplicateEntry(err error) bool

func Escape added in v0.6.0

func Escape(value string) string

Types

type DB

type DB struct {
	*sql.DB
}

func New

func New(ctx context.Context, dsn string, opts ...Option) (*DB, error)

func (*DB) QueryResult added in v0.5.5

func (impl *DB) QueryResult(ctx context.Context, sql string) ([]map[string]any, error)

type Option

type Option func(*Options)

func WithConnMaxIdleTime

func WithConnMaxIdleTime(t time.Duration) Option

func WithConnMaxLifetime

func WithConnMaxLifetime(t time.Duration) Option

func WithMaxIdleConns

func WithMaxIdleConns(n int) Option

func WithMaxOpenConns

func WithMaxOpenConns(n int) Option

type Options

type Options struct {
	MaxIdleConns    int           // 最大空闲连接数
	MaxOpenConns    int           // 最大打开连接数
	ConnMaxLifetime time.Duration // 连接重用最大时间
	ConnMaxIdleTime time.Duration // 连接空闲最大时间
}

Jump to

Keyboard shortcuts

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