bufbuild / protovalidate-go

Protocol Buffer Validation for Go
https://pkg.go.dev/github.com/bufbuild/protovalidate-go
Apache License 2.0
294 stars 19 forks source link

Document recommendation for instantiating/managing validator instances #71

Open rodaine opened 1 year ago

rodaine commented 1 year ago

Title. A few strategies are available, but want to encourage folks to reuse a validator instead of creating a new one for every call to Validate.

Masedko commented 1 year ago

You can compare this to the database instance. You create a database instance that you use everywhere, instead of creating a new one every time you need to query something. The same goes with validator instance

rodaine commented 1 year ago

I like that, @Masedko!