支持传入的跟结构就是数组
This commit is contained in:
@ -7,7 +7,9 @@
|
||||
// Date : 2025-03-23 14:14
|
||||
package dynamicstruct
|
||||
|
||||
import "reflect"
|
||||
import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
type dynamicStructImpl struct {
|
||||
structFields []reflect.StructField
|
||||
@ -16,7 +18,6 @@ type dynamicStructImpl struct {
|
||||
|
||||
// New 创建动态结构体实例
|
||||
func (ds *dynamicStructImpl) New() any {
|
||||
// 不要指针,全部解引用
|
||||
return reflect.New(ds.definition).Interface()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user