I would like to have option to add custom rules for copying fields. Lets say we have date and time separate fields. I would like to copy them as merged.
type From struct {
date string
time string
}
type To struct {
datetime time.Time
}
func (t *To) FromDateTime(f *From) error {
x := //... logic to merge and convert datetime here
t.datetime = x
}
Motivation
Feels like this would be possible already if parameter to receiving function would get the reference to From struct.
func (t *To) date(d string) error {
// missing access to "time"
t.datetime = x
}
Describe the feature
Ability to merge/join multiple fields into one.
I would like to have option to add custom rules for copying fields. Lets say we have date and time separate fields. I would like to copy them as merged.
Motivation
Feels like this would be possible already if parameter to receiving function would get the reference to
From
struct.Related Issues