replace struct value by another struct
package main
import (
"fmt"
"github.com/vincentinttsh/replace"
)
func main() {
var data1 struct {
Name string
UserName string
Email string
Password string
}
data1.Name = "user"
data1.UserName = "user"
data1.Email = "user"
data1.Password = "password"
var data2 struct {
Name *string
UserName *string
Email *string
Password *string
}
value := "newuser"
data2.Name = &value
fmt.Println(data1)
replace.replace(&data1, &data2)
fmt.Println(data1)
}