mysqlx

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(c *Config) (*gorm.DB, error)

func GetConfig

func GetConfig() components.ConfigMap[*Config]

func GetDBClient

func GetDBClient(ctx context.Context, keys ...string) *gorm.DB

func Init

func Init(cm components.ConfigMap[*Config]) (func() error, error)

func IsHealth

func IsHealth() (err error)

Types

type Config

type Config struct {
	Dialect           string `yaml:"dialect" json:"dialect"`
	Host              string `yaml:"host" json:"host"`
	Port              int    `yaml:"port" json:"port"`
	DbName            string `yaml:"db_name" json:"db_name"`
	User              string `yaml:"user" json:"user"`
	Password          string `yaml:"password" json:"password"`
	Charset           string `yaml:"charset" json:"charset"`
	ParseTime         bool   `yaml:"parse_time" json:"parse_time"`
	MaxIdle           int    `yaml:"max_idle" json:"max_idle"`
	MaxOpen           int    `yaml:"max_open" json:"max_open"`
	ConnMaxLifeTime   int    `yaml:"conn_max_life_time" json:"conn_max_life_time"`
	ConnMaxIdleTime   int    `yaml:"conn_max_idle_time" json:"conn_max_idle_time"`
	Debug             bool   `yaml:"debug" json:"debug"`
	NoLog             bool   `yaml:"no_log" json:"no_log"`
	InterpolateParams bool   `yaml:"interpolate_params" json:"interpolate_params"`
	MultiStatements   bool   `yaml:"multi_statements" json:"multi_statements"`
	Timeout           int    `yaml:"timeout" json:"timeout"`
	ReadTimeout       int    `yaml:"read_timeout" json:"read_timeout"`
	WriteTimeout      int    `yaml:"write_timeout" json:"write_timeout"`
}

func (*Config) SetDefault

func (c *Config) SetDefault()

func (*Config) ToDSN

func (c *Config) ToDSN() string

Jump to

Keyboard shortcuts

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