We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example:
package main import "fmt" type MapItem[K, V any] struct { Key K Value V } type SpecificMapValue struct { Field1 string Field2 int Field3 bool } func main() { var mapSlice []MapItem[string, SpecificMapValue] // next we should do unmarshalling: // yaml.Unmarshal([]byte("some yaml here"), &mapSlice) // but generic map slices aren't supported yet fmt.Println(mapSlice) }
The text was updated successfully, but these errors were encountered:
Would it be enough to make MapItem an interface here? Something like that:
MapItem
interface
type MapItem interface { KeyToAny() interface{} ValueToAny() interface{} }
Then the generic MapSlice implementation would be out of go-yaml's scope. E.g. the following code could be used in the app:
MapSlice
go-yaml
type MapSlice[K, V any] []MapItem[K, V] type MapItem[K, V any] struct { Key K Value V } func (m MapItem[K, V]) KeyToAny() interface{} { return m.Key } func (m MapItem[K, V]) ValueToAny() interface{} { return m.Value }
Or the latter code could be on the go-yaml's side too.
Sorry, something went wrong.
No branches or pull requests
Example:
The text was updated successfully, but these errors were encountered: