序列化增加接口约束
This commit is contained in:
12
file.go
12
file.go
@ -67,7 +67,7 @@ func (f *file) GetProjectPath() (string, error) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 10:35 下午 2021/4/26
|
||||
func (f *file) ReadYmlContent(filePath string, result interface{}) error {
|
||||
func (f *file) ReadYmlContent(filePath string, result any) error {
|
||||
if nil == result {
|
||||
return errors.New("接收读取结果的数据指针为NIL")
|
||||
}
|
||||
@ -86,7 +86,7 @@ func (f *file) ReadYmlContent(filePath string, result interface{}) error {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:23 2022/6/9
|
||||
func (f *file) ReadJSONContent(filePath string, result interface{}) error {
|
||||
func (f *file) ReadJSONContent(filePath string, result any) error {
|
||||
if nil == result {
|
||||
return errors.New("接收读取结果的数据指针为NIL")
|
||||
}
|
||||
@ -105,7 +105,7 @@ func (f *file) ReadJSONContent(filePath string, result interface{}) error {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 13:21 2022/7/2
|
||||
func (f *file) ReadIniContent(filePath string, result interface{}) error {
|
||||
func (f *file) ReadIniContent(filePath string, result any) error {
|
||||
if nil == result {
|
||||
return errors.New("接收读取结果的数据指针为NIL")
|
||||
}
|
||||
@ -117,7 +117,7 @@ func (f *file) ReadIniContent(filePath string, result interface{}) error {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:08 2023/7/31
|
||||
func (f *file) ReadTomlContent(filePath string, result interface{}) error {
|
||||
func (f *file) ReadTomlContent(filePath string, result any) error {
|
||||
if nil == result {
|
||||
return errors.New("接收读取结果的数据指针为NIL")
|
||||
}
|
||||
@ -132,9 +132,9 @@ func (f *file) ReadTomlContent(filePath string, result interface{}) error {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 13:11 2022/7/2
|
||||
func (f *file) ReadAnyFileContent(filePath string, receiver interface{}) error {
|
||||
func (f *file) ReadAnyFileContent(filePath string, receiver any) error {
|
||||
var (
|
||||
parseFunc func(filePath string, receiver interface{}) error
|
||||
parseFunc func(filePath string, receiver any) error
|
||||
)
|
||||
filePathArr := strings.Split(filePath, "#@#")
|
||||
fileExt := ""
|
||||
|
Reference in New Issue
Block a user