Compare commits
2 Commits
520bf437cd
...
63b497c497
Author | SHA1 | Date | |
---|---|---|---|
63b497c497 | |||
9c51e86e3a |
@ -97,6 +97,9 @@ func getLogInstance(logConf *LogConfig, loggerInstance *zap.Logger) (*zap.Logger
|
||||
if nil != loggerInstance {
|
||||
return loggerInstance, nil
|
||||
}
|
||||
if nil == logConf {
|
||||
return nil, nil
|
||||
}
|
||||
logConfList := []logger.SetLoggerOptionFunc{logger.WithEncoder(logConf.Encoder), logger.WithCallerSkip(logConf.Skip), logger.WithCaller()}
|
||||
if logConf.ConsoleOutput {
|
||||
logConfList = append(logConfList, logger.WithConsoleOutput())
|
||||
|
37
system.go
Normal file
37
system.go
Normal file
@ -0,0 +1,37 @@
|
||||
// Package mysql ...
|
||||
//
|
||||
// Description : mysql ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2022-05-15 19:32
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// SystemDao 执行一些系统的mysql命令
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 19:32 2022/5/15
|
||||
type SystemDao struct {
|
||||
}
|
||||
|
||||
// GetTableList 查询数据表
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 19:36 2022/5/15
|
||||
func (sd *SystemDao) GetTableList(dbInstance *gorm.DB) ([]string, error) {
|
||||
var (
|
||||
err error
|
||||
result []string
|
||||
)
|
||||
|
||||
if err = dbInstance.Raw("SHOW TABLES").Scan(&result).Error; nil != err {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user