feature/upgrade_dynamic_struct #9

Merged
zhangdeman merged 9 commits from feature/upgrade_dynamic_struct into master 2025-03-21 18:27:12 +08:00
Showing only changes of commit febf5a63ad - Show all commits

View File

@ -8,6 +8,7 @@
package wrapper
import (
"encoding/json"
"fmt"
"reflect"
)
@ -218,3 +219,12 @@ func (ds *DynamicStruct) Clear() {
// 清理掉已设置的字段, 不然实例复用会互相影响
ds.structFieldList = make([]reflect.StructField, 0)
}
// MarshalJSON 自定义的序列化方法
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 18:47 2025/1/24
func (ds *DynamicStruct) MarshalJSON() ([]byte, error) {
return json.Marshal(ds.mapData)
}