mysql

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDuplicateKeyError

func IsDuplicateKeyError(err error) bool

func IsNoFoundError

func IsNoFoundError(err error) bool

func OperatorErr

func OperatorErr(db *gorm.DB) (rows int64, err error)

func RegisterCallbacks

func RegisterCallbacks(db *gorm.DB)

func WrapErr

func WrapErr(err error) error

Types

type Client

type Client struct {
	DB *gorm.DB
}

func NewClient

func NewClient(cfg *Config) (c *Client, err error)

type Config

type Config struct {
	Host             string         `json:"host"`
	Port             int            `json:"port"`
	User             string         `json:"user"`
	Password         string         `json:"password"`
	Database         string         `json:"database"`
	SlaveHost        string         `json:"slave_host,omitempty"`
	SlavePort        int            `json:"slave_port,omitempty"`
	SlaveUser        string         `json:"slave_user,omitempty"`
	SlavePassword    string         `json:"slave_password,omitempty"`
	SlaveDatabase    string         `json:"slave_database,omitempty"`
	MaxOpenConn      int            `json:"max_open_conn,omitempty"`
	MaxIdleConn      int            `json:"max_idle_conn,omitempty"`
	MaxIdleTimeSec   int            `json:"max_life_time_sec,omitempty"`
	LogConfig        *sql.LogConfig `json:"log_config,omitempty"`
	DisableErrorHook bool           `json:"disable_error_hook,omitempty"`
}

Jump to

Keyboard shortcuts

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