Open cuducos opened 3 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Overview
In some use cases, it might make sense to just load a table and a schema and validate whether the table data matches what is expected by the schema.
This is different than
Schema.Validate()
(which validate the schema itself) and from iterating through table rows casting them to a struct (in that case, validation would be made against the struct, not against the schema).If that sounds interesting for this package I'd be happy to try to implement it.
Intended roadmap
A suggested API would be something like
func (t *Table) Validate(s Schema) error
.This function/method would iterate over the table and over its rows trying to cast each field. If casting fails, validates returns false and we can add an error message pointing the user to the lines that caused the validation to fail.
Please preserve this line to notify @danielfireman (lead of this repository)