Discover Packages
github.com/hyacinthus/x
xdb
package
Version:
v0.0.0-...-d6b644b
Opens a new window with list of versions in this module.
Published: Apr 10, 2020
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 2
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package xdb 获得一个 gorm 的 db client,
虽然 db 客户端会自动重连,但是首次若连接不成功会报错,这里会持续尝试连接。
New 用配置生成一个 gorm mysql 数据库对象,若目标数据库未启动会一直等待
type Config struct {
Host string `default:"mysql"`
Port string `default:"3306"`
User string `default:"root"`
Password string `default:"root"`
Name string
Lifetime int `default:"3000"`
}
Config 数据库配置,可以被主配置直接引用
Source Files
¶
Click to show internal directories.
Click to hide internal directories.