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

Use generics instead of interface{} only in V2 #2

Open
joegasewicz opened this issue Jun 4, 2022 · 0 comments
Open

Use generics instead of interface{} only in V2 #2

joegasewicz opened this issue Jun 4, 2022 · 0 comments
Assignees

Comments

@joegasewicz
Copy link
Owner

joegasewicz commented Jun 4, 2022

func GetFormValue[T any](name string, c *Config) T {
	var value T
	for _, v := range c.Fields {
		if v.Name == name {
			value = v.Value
		}
	}
	return value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant