A package of validators and sanitizers for strings, structs and collections. Based on validator.js. Activate behavior to require all fields have a validation tag by default. SetFieldsRequiredByDefault causes validation to fail when struct fields do not include validations or are not explicitly marked as exempt (using valid:"-" or valid:"email,optional"). A good place to activate this is a package init function or the main() function. SetNilPtrAllowedByRequired causes validation to pass when struct fields marked by required are set to nil. This is disabled by default for consistency, but some packages that need to be able to determine between nil and zero value state can use this. If disabled, both nil and zero values cause validation errors. If you want to validate structs, you can use tag valid for any field in your structure. All validators used with this field in one tag are separated by comma.

Features

  • Custom validator function signature
  • Add custom validators
  • Completely custom validators
  • Validate maps
  • Custom validation using your own domain specific validators
  • Custom error messages are supported

Project Samples

Project Activity

See All Activity >

Categories

Package Managers

License

MIT License

Follow govalidator

govalidator Web Site

Other Useful Business Software
Train ML Models With SQL You Already Know Icon
Train ML Models With SQL You Already Know

BigQuery automates data prep, analysis, and predictions with built-in AI assistance.

Build and deploy ML models using familiar SQL. Automate data prep with built-in Gemini. Query 1 TB and store 10 GB free monthly.
Try Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of govalidator!

Additional Project Details

Programming Language

Go

Related Categories

Go Package Managers

Registered

2021-11-23