How do you validate your structures?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/golang

Our great sponsors
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • SonarLint - Clean code begins in your IDE with SonarLint
  • SaaSHub - Software Alternatives and Reviews
  • ozzo-validation

    An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.

    https://github.com/go-ozzo/ozzo-validation/blob/v3.6.0/struct.go#L61

  • validator

    I'm looking for a data validator and I don't like this approach where validation details are a part of tags: `validation:magic,42`. I've written my own validator but it's more like an example rather than complete implementation and it's not my particular task right now and I will be really happy to find something like that: ``go type User struct { Name stringjson:"name" Email stringjson:"email" Message stringjson:"message"` }

  • InfluxDB

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Platform where developers build real-time applications for analytics, IoT and cloud-native services. Easy to start, it is available in the cloud or on-premises.

  • validator

    :100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving

    I like this https://github.com/go-playground/validator There are alot of predefined rule so I can validate simple struct without writing anycode. You can write your own custom validation functions as well.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts