diff --git a/system.go b/system.go new file mode 100644 index 0000000..bb782b2 --- /dev/null +++ b/system.go @@ -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 +}