:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
We will take a look at package go-playground/validator v10, which is almost the number one choice for such problems in Go.
Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services. (by google)
So, we have a field with type uuid.UUID which we create with the package google/uuid, which we want to check with the built-in validator uuid.Parse() of that package. All we need to do is add a new RegisterValidation method to the NewValidator function (described above) with simple logic code:
Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.
⚡️ Express inspired web framework written in Go
Furthermore, in the example below, I took code from my project written using the Fiber web framework. So, some elements from its libraries are present there. Don't be scared, the main thing here is to understand the principle of validation itself.
Are if statements enough for validation?
2 projects | reddit.com/r/golang | 3 Sep 2021
How do you validate your structures?
5 projects | reddit.com/r/golang | 31 May 2021
Run Ordinary Rails Apps Globally
4 projects | news.ycombinator.com | 26 Jan 2022
Building microservices in Go with Gin
7 projects | dev.to | 27 Jan 2022
Best courses to learn Go for backend?
4 projects | reddit.com/r/golang | 24 Jan 2022