An interesting go struct tag expression syntax for field validation, etc.
Usage
Validator: A powerful validator that supports struct tag expression
Binding: A powerful HTTP request parameters binder that supports struct tag expression
Feature
Support for a variety of common operator
Support for accessing arrays, slices, members of the dictionary
Support access to any field in the current structure
Support access to nested fields, non-exported fields, etc.
Support variable
Support registers function expression
Built-in len, sprintf, regexp functions
Support single mode and multiple mode to define expression
Parameter check subpackage
Use offset pointers to directly take values, better performance
Required go version ≥1.9
Example
package tagexpr_test
import (
"fmt"
tagexpr "github.com/bytedance/go-tagexpr/v2"
)
func Example() {
type T struct {
A int `tagexpr:"lt;0||gt;=100"`
B string `tagexpr:"len($)>1 && regexp('^\w*
go-tagexpr

An interesting go struct tag expression syntax for field validation, etc.
Usage
Validator: A powerful validator that supports struct tag expression
Binding: A powerful HTTP request parameters binder that supports struct tag expression
Feature
Example