// The field under validation must be present and not empty only if any of the other specified fields are present.
// The field under validation must be present and not empty only if any of the other specified fields are present.
funcrequiredWith(flFieldLevel)bool{
funcrequiredWith(flFieldLevel)bool{
params:=parseOneOfParam2(fl.Param())
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
for_,param:=rangeparams{
ifrequireCheckFieldKind(fl,param){
ifrequireCheckFieldKind(fl,param){
returnrequireCheckFieldKind(fl,"")
returnrequireCheckFieldKind(fl,"")
}
}
}
}
returntrue
returntrue
}
}
// RequiredWithAll is the validation function
// 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.
// The field under validation must be present and not empty only if all of the other specified fields are present.
funcrequiredWithAll(flFieldLevel)bool{
funcrequiredWithAll(flFieldLevel)bool{
isValidateCurrentField:=true
isValidateCurrentField:=true
params:=parseOneOfParam2(fl.Param())
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
for_,param:=rangeparams{
if!requireCheckFieldKind(fl,param){
if!requireCheckFieldKind(fl,param){
isValidateCurrentField=false
isValidateCurrentField=false
break
}
}
}
}
ifisValidateCurrentField{
ifisValidateCurrentField{
returnrequireCheckFieldKind(fl,"")
returnrequireCheckFieldKind(fl,"")
}
}
returntrue
returntrue
}
}
// RequiredWithout is the validation function
// 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.
// The field under validation must be present and not empty only when any of the other specified fields are not present.
funcrequiredWithout(flFieldLevel)bool{
funcrequiredWithout(flFieldLevel)bool{
isValidateCurrentField:=false
params:=parseOneOfParam2(fl.Param())
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
for_,param:=rangeparams{
if!requireCheckFieldKind(fl,param){
ifrequireCheckFieldKind(fl,param){
returnhasValue(fl)
isValidateCurrentField=true
}
}
}
if!isValidateCurrentField{
returnrequireCheckFieldKind(fl,"")
}
}
returntrue
returntrue
}
}
// RequiredWithoutAll is the validation function
// 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.
// The field under validation must be present and not empty only when all of the other specified fields are not present.
funcrequiredWithoutAll(flFieldLevel)bool{
funcrequiredWithoutAll(flFieldLevel)bool{
isValidateCurrentField:=true
params:=parseOneOfParam2(fl.Param())
params:=parseOneOfParam2(fl.Param())
for_,param:=rangeparams{
for_,param:=rangeparams{
ifrequireCheckFieldKind(fl,param){
ifrequireCheckFieldKind(fl,param){
isValidateCurrentField=false
returntrue
}
}
}
}
returnhasValue(fl)
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.