sdb

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const MySQLDefaultCharset = `utf8mb4`

Variables

View Source
var (
	MySQLSupportCharsetList = []string{
		MySQLDefaultCharset,
		`utf8`,
	}
)

Functions

This section is empty.

Types

type DB

type DB struct {
	Type            string            `json:"type"`
	User            string            `json:"user"`
	Password        string            `json:"password"`
	Host            string            `json:"host"`
	Database        string            `json:"database"`
	Prefix          string            `json:"prefix"`
	Options         map[string]string `json:"options"`
	Debug           bool              `json:"debug"`
	ConnMaxLifetime string            `json:"connMaxLifetime"` //example: 10s
	MaxIdleConns    int               `json:"maxIdleConns"`
	MaxOpenConns    int               `json:"maxOpenConns"`
	// contains filtered or unexported fields
}

func (*DB) Charset

func (d *DB) Charset() string

func (*DB) ConnMaxDuration

func (d *DB) ConnMaxDuration() time.Duration

func (*DB) Description

func (d *DB) Description() string

func (*DB) GetByKey

func (d *DB) GetByKey(key string) (string, bool)

func (*DB) SetConn

func (d *DB) SetConn(setter DBConnSetter) error

func (*DB) SetDebug

func (d *DB) SetDebug(on bool)

func (*DB) SetKV

func (d *DB) SetKV(key string, value string) *DB

func (*DB) Table

func (d *DB) Table(table string) string

func (*DB) ToMySQL

func (d *DB) ToMySQL() mysql.ConnectionURL

func (*DB) ToTable

func (d *DB) ToTable(m sqlbuilder.Name_) string

type DBConnSetter

type DBConnSetter interface {
	SetConnMaxLifetime(time.Duration)
	SetMaxIdleConns(int)
	SetMaxOpenConns(int)
}

Jump to

Keyboard shortcuts

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