Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom function for merging fields #194

Open
dcrystalj opened this issue Sep 30, 2023 · 0 comments
Open

Custom function for merging fields #194

dcrystalj opened this issue Sep 30, 2023 · 0 comments
Assignees

Comments

@dcrystalj
Copy link

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.

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
}

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants