切换序列化库

This commit is contained in:
2023-08-11 14:01:18 +08:00
parent f6b53ac73d
commit 02d11bf306
3 changed files with 45 additions and 82 deletions

View File

@ -10,12 +10,11 @@ package database
import (
"errors"
"fmt"
"git.zhangdeman.cn/zhangdeman/serialize"
"path/filepath"
"strings"
"sync"
"git.zhangdeman.cn/zhangdeman/util"
"git.zhangdeman.cn/zhangdeman/logger/wrapper"
"github.com/gin-gonic/gin"
@ -137,12 +136,12 @@ func (c *client) getCfg(cfgPath string) (*cfgFile, error) {
fallthrough
case FileTypeYml:
result.Type = FileTypeYaml
if err = util.File.ReadYmlContent(cfgPath, &result.Config); nil != err {
if err = serialize.File.ReadYmlContent(cfgPath, &result.Config); nil != err {
return nil, fmt.Errorf("%s 配置文件解析失败, 原因 : %s", cfgPath, err.Error())
}
case FileTypeJson:
result.Type = FileTypeJson
if err = util.File.ReadJSONContent(cfgPath, &cfgInfo); nil != err {
if err = serialize.File.ReadJSONContent(cfgPath, &cfgInfo); nil != err {
return nil, fmt.Errorf("%s 配置文件解析失败, 原因 : %s", cfgPath, err.Error())
}
default: