orm

package
v0.0.0-...-f0a2dc7 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectMysql

func ConnectMysql(m Mysql) (*gorm.DB, error)

func Ping

func Ping(dsn string) bool

Types

type Config

type Config struct {
	Addr          string `yaml:"Addr"`
	Username      string `yaml:"Username"`
	Password      string `yaml:"Password"`
	Dbname        string `yaml:"Dbname"`
	Config        string `yaml:"Config" default:"charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai"`
	MaxIdleConns  int    `yaml:"MaxIdleConns" default:"10"`
	MaxOpenConns  int    `yaml:"MaxOpenConns" default:"10"`
	SlowThreshold int64  `yaml:"SlowThreshold" default:"1000"`
}

func ParseDSN

func ParseDSN(dsn string) *Config

type Mysql

type Mysql struct {
	Config Config
}

func (*Mysql) Dsn

func (m *Mysql) Dsn() string

func (*Mysql) GetColorful

func (m *Mysql) GetColorful() bool

func (*Mysql) GetSlowThreshold

func (m *Mysql) GetSlowThreshold() time.Duration

Jump to

Keyboard shortcuts

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