支持嵌套结构体 #1
| @ -1,7 +1,6 @@ | ||||
| package dynamicstruct | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"reflect" | ||||
| 	"strings" | ||||
| ) | ||||
| @ -106,7 +105,7 @@ func (b *builderImpl) AddField(name string, pkg string, typ any, tag string, ano | ||||
| 		return b | ||||
| 	} | ||||
| 	// TODO : 添加嵌套的结构体 | ||||
| 	fmt.Println(fieldNameArr) | ||||
| 	b.addNestedField(fieldNameArr, pkg, typ, tag, anonymous) | ||||
| 	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 根据名称移除结构体字段 | ||||
| func (b *builderImpl) RemoveField(name string) Builder { | ||||
| 	newFieldList := make([]*fieldConfigImpl, 0) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user