github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/validate/matcher/accept.go (about)

     1  package matcher
     2  
     3  import (
     4  	"github.com/isyscore/isc-gobase/constants"
     5  	"reflect"
     6  	"strconv"
     7  	"strings"
     8  )
     9  
    10  func CollectAccept(objectTypeFullName string, _ reflect.Kind, objectFieldName string, tagName string, subCondition string, errMsg string) {
    11  	if constants.Accept != tagName {
    12  		return
    13  	}
    14  
    15  	accept, err := strconv.ParseBool(strings.TrimSpace(subCondition))
    16  	if err != nil {
    17  		return
    18  	}
    19  	addMatcher(objectTypeFullName, objectFieldName, nil, errMsg, accept)
    20  }