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

Support variables/constants in goverter:map (map custom) #123

Open
jmattheis opened this issue Jan 9, 2024 · 0 comments
Open

Support variables/constants in goverter:map (map custom) #123

jmattheis opened this issue Jan 9, 2024 · 0 comments
Labels
feature New feature or request

Comments

@jmattheis
Copy link
Owner

Currently only methods are allowed in goverter:map. It would be useful to support variables / constants to, because they are sometimes already present. E.g.

package example

import "time"

// goverter:converter
type Converter interface {
    // goverter:map Value | time:Second
	Convert(Input) Output
}

type Input struct {
	Name string
}
type Output struct {
	Name  string
	Value time.Duration
}

this should normally convert Input#Name -> Output#Name and use the constant time.Second for Output#Value.

Please 👍 this issue if you like this functionality. If you have a specific use-case in mind, feel free to comment it.

@jmattheis jmattheis added the feature New feature or request label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant