Documentation ¶ Index ¶ func New(config Config) *gorm.DB func SetLogger(logger *zap.SugaredLogger) type Config Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func New ¶ func New(config Config) *gorm.DB New 用配置生成一个 gorm mysql 数据库对象,若目标数据库未启动会一直等待 func SetLogger ¶ func SetLogger(logger *zap.SugaredLogger) Types ¶ type Config ¶ 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 ¶ View all Source files xdb.go Click to show internal directories. Click to hide internal directories.