I was doing some tests relate to issue #14 not having field's information were causing me some trouble. Then i just found out the function parameters were taking parts of the field struct.
I think breaking a struct in many pieces is a not very good pratice and for every new verification of the field we want to do inside the function a new parameter needs to be created.
Better error messages is a example of this. I want to use the Field name in the message and a new parameter would have to be created.
Here is my suggestion
turn
type StructValidatorFunc func(v reflect.Value, typ reflect.Type, param string) error
into
type StructValidatorFunc func(field field, param string) error
I was doing some tests relate to issue #14 not having field's information were causing me some trouble. Then i just found out the function parameters were taking parts of the field struct.
I think breaking a struct in many pieces is a not very good pratice and for every new verification of the field we want to do inside the function a new parameter needs to be created.
Better error messages is a example of this. I want to use the Field name in the message and a new parameter would have to be created.
Here is my suggestion
turn
type StructValidatorFunc func(v reflect.Value, typ reflect.Type, param string) errorinto
type StructValidatorFunc func(field field, param string) error