增加数据表结构查询的方法

This commit is contained in:
2023-08-16 23:16:35 +08:00
parent 42208f1b2d
commit 73949714fc
3 changed files with 95 additions and 14 deletions

View File

@ -10,6 +10,7 @@ package database
import (
"errors"
"fmt"
"git.zhangdeman.cn/zhangdeman/consts"
"git.zhangdeman.cn/zhangdeman/serialize"
"path/filepath"
"strings"
@ -132,15 +133,15 @@ func (c *client) getCfg(cfgPath string) (*cfgFile, error) {
cfgInfo Database
)
switch fileType {
case FileTypeYaml:
case consts.FileTypeYaml:
fallthrough
case FileTypeYml:
result.Type = FileTypeYaml
case consts.FileTypeYml:
result.Type = consts.FileTypeYaml
if err = serialize.File.ReadYmlContent(cfgPath, &result.Config); nil != err {
return nil, fmt.Errorf("%s 配置文件解析失败, 原因 : %s", cfgPath, err.Error())
}
case FileTypeJson:
result.Type = FileTypeJson
case consts.FileTypeJson:
result.Type = consts.FileTypeJson
if err = serialize.File.ReadJSONContent(cfgPath, &cfgInfo); nil != err {
return nil, fmt.Errorf("%s 配置文件解析失败, 原因 : %s", cfgPath, err.Error())
}