mysql

package
v4.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig() *mysql.Config

NewConfig 创建一个标准的 *mysql.Config

func NewConfigFromMicroConfigKey

func NewConfigFromMicroConfigKey(cfgKey ...string) (*mysql.Config, error)

NewDbClientFromConfig 通过 Micro Config 的配置创建 DbClient

func NewConfigFromMicroConfigValue

func NewConfigFromMicroConfigValue(v reader.Value) (*mysql.Config, error)

NewConfigFromMicroConfigValue 通过 Micro Config 的 reader.Value 创建 DbClient

func NewTLSConfig

func NewTLSConfig(rootCert string) (*tls.Config, error)

Types

type DB

type DB = gorm.DB

func OpenDB

func OpenDB(opt ...Option) (*DB, error)

OpenDB is alias of OpenGormDB.

func OpenGormDB

func OpenGormDB(opt ...Option) (*DB, error)

OpenGormDB 打开一个 *gorm.DB 的连接

type Option

type Option func(*Options)

Option 是设置 Options 的函数

func WithLogLevel

func WithLogLevel(lv log.Level) Option

func WithMySQLConfig

func WithMySQLConfig(cfg *mysql.Config) Option

func WithTLS

func WithTLS(cfg *tls.Config) Option

type Options

type Options struct {
	MySqlCfg *mysql.Config
	TLSCfg   *tls.Config
	LogLevel log.Level
}

func NewOptions

func NewOptions(opt ...Option) *Options

NewOptions 设置 Options

Jump to

Keyboard shortcuts

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