db

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDbClient

func InitDbClient(conf model.MysqlConf) error

InitDbClient 初始化DbClient 通过conf 下的MysqlConf 获取相关配置,复制给MySQLConfig

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a MySQL client

var DbClient *Client

DbClient 定义一个全局的Client变量,以便在整个程序中使用

func NewClient

func NewClient(config model.MysqlConf) (*Client, error)

NewClient creates a new MySQL client

func (*Client) Close

func (c *Client) Close() *xerrors.Error

Close closes the MySQL client connection

func (*Client) DB added in v0.1.1

func (c *Client) DB() *gorm.DB

func (*Client) Ping

func (c *Client) Ping() *xerrors.Error

Ping pings the MySQL database

Jump to

Keyboard shortcuts

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