-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Description
I faced the issue with validating geo coordinates using is pkg.
Code example:
type GeoPosition struct {
Latitude float32
Longitude float32
}
func (g *GeoPosition) Validate() error {
return validation.ValidateStruct(g,
validation.Field(&g.Latitude, validation.Required, is.Latitude),
validation.Field(&g.Longitude, validation.Required, is.Longitude),
)
}
It returns an error like that: GeoPosition: (Latitude: must be either a string or byte slice.)..
That confuses me a bit. I dug into the issues and found that is pkg only applicable to string/slice byte types.
So what's the way to address Latitude/Longitude validation for float types?
I see only one option - custom validation creation, but that's an inconvenient way to handle that. Any plans to use generics for that?
Metadata
Metadata
Assignees
Labels
No labels