devfeel / mapper

A simple and easy go tools for auto mapper map to struct, struct to map, struct to struct, slice to slice, map to slice, map to json.
MIT License
390 stars 34 forks source link

proposal: support mapping between pointer and value #25

Open shyandsy opened 2 years ago

shyandsy commented 2 years ago

I plan to make a new feature to support mapping between pointer and value

example:

type A struct{
    Age int `mapper:"age"`
}

type B struct{
    Age *int `mapper:"age"`
} 

func main(){
    a := A{Age:1}
    b := B{}
    m := mapper.NewMapper()

    m.Mapper(&a, &b)

    // now b.Age = 1
}