支持嵌套结构体 #1

Merged
zhangdeman merged 6 commits from feture/nested_struct into master 2025-03-21 23:43:27 +08:00
Showing only changes of commit 4e072ebcec - Show all commits

View File

@ -1,7 +1,6 @@
package dynamicstruct package dynamicstruct
import ( import (
"fmt"
"reflect" "reflect"
"strings" "strings"
) )
@ -106,7 +105,7 @@ func (b *builderImpl) AddField(name string, pkg string, typ any, tag string, ano
return b return b
} }
// TODO : 添加嵌套的结构体 // TODO : 添加嵌套的结构体
fmt.Println(fieldNameArr) b.addNestedField(fieldNameArr, pkg, typ, tag, anonymous)
return b return b
} }
@ -128,6 +127,10 @@ func (b *builderImpl) addNormalField(name string, pkg string, typ any, tag strin
}) })
} }
// addNestedField 添加嵌套字段
func (b *builderImpl) addNestedField(nameArr []string, pkg string, typ any, tag string, anonymous bool) {
}
// RemoveField 根据名称移除结构体字段 // RemoveField 根据名称移除结构体字段
func (b *builderImpl) RemoveField(name string) Builder { func (b *builderImpl) RemoveField(name string) Builder {
newFieldList := make([]*fieldConfigImpl, 0) newFieldList := make([]*fieldConfigImpl, 0)