DEV Community

Cover image for ๐Ÿ”ฅ Introducing Zogo: A Powerful Custom Validation Library for Go
Francisco Inoque
Francisco Inoque

Posted on

๐Ÿ”ฅ Introducing Zogo: A Powerful Custom Validation Library for Go

Introduction:

Hey fellow developers! ๐Ÿš€ Are you tired of writing repetitive validation code for your Go projects? Look no further! Allow me to introduce you to Zogo, a blazing-fast custom validation library that will simplify your life and help you maintain cleaner and more organized code.

What is Zogo?

Zogo is a comprehensive validation library crafted specifically for Go developers. With Zogo, you can effortlessly validate various data fields in your applications using a collection of pre-built validation rules. Whether you're validating strings, numbers, emails, booleans, or any other type of data, Zogo has got your back!

Key Features:

  • โœ… Ease of Use: Zogo provides a user-friendly API that makes adding validation rules a breeze.
  • โšก Customizable: Tailor validation rules to your specific project requirements.
  • ๐Ÿ“‹ Available Validation Rules: Min/Max Length, Min/Max Value, String Not Empty, Email, Boolean, and more!
  • ๐Ÿš€ High Performance: Zogo is designed for speed, ensuring minimal impact on your application's performance.
  • ๐Ÿงช Tested and Reliable: Rigorously tested to ensure stability and reliability.
  • ๐Ÿ“š Detailed Documentation: Comprehensive documentation to guide you through usage.

Example: Validating Age with Zogo

Let's say you want to validate a person's age, ensuring it's represented as a string of at least 2 characters and not less than 18. With Zogo, achieving this is a breeze:

validator := zogo.NewFormValidator()

validator.AddRule("age", zogo.MinLengthValidator(2)) // Minimum of 2 characters


data := map[string]interface{}{
    "age": "20", // Age as a string
    // ... other fields
}

if err := validator.Validate(data); err != nil {
    fmt.Println("Validation Error:", err)
} else {
    fmt.Println("Data is valid.")
}
Enter fullscreen mode Exit fullscreen mode

Get Started with Zogo:

Getting started with Zogo is super easy! Just install it via:

go get github.com/frantchessico/zogo

Enter fullscreen mode Exit fullscreen mode

You can find detailed usage instructions, examples, and more in the Zogo GitHub repository.

Conclusion:

Say goodbye to writing repetitive validation code and embrace the power of Zogo! Experience efficient, customizable, and high-performance validation in your Go projects. Give Zogo a try and unlock a new level of development productivity today. Happy coding! ๐Ÿ’ป๐Ÿš€


Feel free to tweak the content to suit your preferences and needs. Make sure to replace "yourusername" and "yourproject" with the actual GitHub username and project name before posting on dev.to. Good luck with your post!

Top comments (0)