jinzhu / copier

Copier for golang, copy value from struct to struct and more
MIT License
5.57k stars 489 forks source link

能否支持结构体内嵌字段到切片的拷贝 #218

Open luoshaofeng opened 2 months ago

luoshaofeng commented 2 months ago

Describe the feature

比如有结构体A和D

type A struct{
    C int
    D *D
}

type D struct{
    B int
    E int
}

有切片var as []A,var ds[]D,以类似copier.Copy(&ds,as)的方式,直接把A.D拷贝到ds切片中

Motivation

简化代码,不用遍历A切片

Related Issues