// The field under validation must be present and not empty only if any of the other specified fields are present.
funcrequiredWith(flFieldLevel)bool{
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
ifrequireCheckFieldKind(fl,param){
returnrequireCheckFieldKind(fl,"")
}
}
returntrue
}
// RequiredWithAll is the validation function
// The field under validation must be present and not empty only if all of the other specified fields are present.
funcrequiredWithAll(flFieldLevel)bool{
isValidateCurrentField:=true
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
if!requireCheckFieldKind(fl,param){
isValidateCurrentField=false
}
}
ifisValidateCurrentField{
returnrequireCheckFieldKind(fl,"")
}
returntrue
}
// RequiredWithout is the validation function
// The field under validation must be present and not empty only when any of the other specified fields are not present.
funcrequiredWithout(flFieldLevel)bool{
isValidateCurrentField:=false
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
ifrequireCheckFieldKind(fl,param){
isValidateCurrentField=true
}
}
if!isValidateCurrentField{
returnrequireCheckFieldKind(fl,"")
}
returntrue
}
// RequiredWithoutAll is the validation function
// The field under validation must be present and not empty only when all of the other specified fields are not present.
funcrequiredWithoutAll(flFieldLevel)bool{
isValidateCurrentField:=true
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
ifrequireCheckFieldKind(fl,param){
isValidateCurrentField=false
}
}
ifisValidateCurrentField{
returnrequireCheckFieldKind(fl,"")
}
returntrue
}
// IsGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value.
// IsGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value.