slice of typed strings
given the type
type MyString string
and an object of
struct {
Thing MyString
Things []MyString
}
Thing will scan fine, as there's a conversion from *string to *MyString. Things will not. Value panics because it cannot come up with a conversion from *[]string to *[]MyString
*MyString works because pgtype uses reflection to determine the underlying type is a *string. However, the underlying type of []MyString is not []string. This makes automagically handling it much more difficult.
This could be made to work with sufficient reflection. However, the would be a definite performance cost to doing so. I believe each element would need to go through the entire reflection process individually.
I'm not opposed to this feature, but an implementation would need to meet two conditions.
- Not introduce an undue amount of complexity into the code base.
- Have benchmarks that show the performance cost is acceptable.