序列化约束升级 #1

Merged
zhangdeman merged 5 commits from feature/xml into master 2024-10-23 18:42:59 +08:00
Showing only changes of commit 77f0930081 - Show all commits

View File

@ -121,7 +121,7 @@ func (f *file) ReadTomlContent(filePath string, result any) error {
if nil == result { if nil == result {
return errors.New("接收读取结果的数据指针为NIL") return errors.New("接收读取结果的数据指针为NIL")
} }
if _, err := toml.DecodeFile("example.toml", result); err != nil { if _, err := toml.DecodeFile(filePath, result); err != nil {
return err return err
} }
return nil return nil
@ -147,9 +147,7 @@ func (f *file) ReadAnyFileContent(filePath string, receiver any) error {
switch fileExt { switch fileExt {
case consts.FileTypeJson: case consts.FileTypeJson:
parseFunc = f.ReadJSONContent parseFunc = f.ReadJSONContent
case consts.FileTypeYml: case consts.FileTypeYml, consts.FileTypeYaml:
fallthrough
case consts.FileTypeYaml:
parseFunc = f.ReadYmlContent parseFunc = f.ReadYmlContent
case consts.FileTypeIni: case consts.FileTypeIni:
parseFunc = f.ReadIniContent parseFunc = f.ReadIniContent