You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The field under validation must be present and not empty only if any of the other specified fields are present.
1330
1339
funcrequiredWith(flFieldLevel) bool {
1331
-
1332
1340
params:=parseOneOfParam2(fl.Param())
1333
1341
for_, param:=rangeparams {
1334
-
1335
-
ifrequireCheckFieldKind(fl, param) {
1336
-
returnrequireCheckFieldKind(fl, "")
1342
+
ifrequireCheckFieldKind(fl, param, false) {
1343
+
returnhasValue(fl)
1337
1344
}
1338
1345
}
1339
-
1340
1346
returntrue
1341
1347
}
1342
1348
1343
1349
// RequiredWithAll is the validation function
1344
1350
// The field under validation must be present and not empty only if all of the other specified fields are present.
1345
1351
funcrequiredWithAll(flFieldLevel) bool {
1346
-
1347
-
isValidateCurrentField:=true
1348
1352
params:=parseOneOfParam2(fl.Param())
1349
1353
for_, param:=rangeparams {
1350
-
1351
-
if!requireCheckFieldKind(fl, param) {
1352
-
isValidateCurrentField=false
1354
+
if!requireCheckFieldKind(fl, param, false) {
1355
+
returntrue
1353
1356
}
1354
1357
}
1355
-
1356
-
ifisValidateCurrentField {
1357
-
returnrequireCheckFieldKind(fl, "")
1358
-
}
1359
-
1360
-
returntrue
1358
+
returnhasValue(fl)
1361
1359
}
1362
1360
1363
1361
// RequiredWithout is the validation function
1364
1362
// The field under validation must be present and not empty only when any of the other specified fields are not present.
1365
1363
funcrequiredWithout(flFieldLevel) bool {
1366
-
1367
-
isValidateCurrentField:=false
1368
1364
params:=parseOneOfParam2(fl.Param())
1369
1365
for_, param:=rangeparams {
1370
-
1371
-
ifrequireCheckFieldKind(fl, param) {
1372
-
isValidateCurrentField=true
1366
+
if!requireCheckFieldKind(fl, param, true) {
1367
+
returnhasValue(fl)
1373
1368
}
1374
1369
}
1375
-
1376
-
if!isValidateCurrentField {
1377
-
returnrequireCheckFieldKind(fl, "")
1378
-
}
1379
-
1380
1370
returntrue
1381
1371
}
1382
1372
1383
1373
// RequiredWithoutAll is the validation function
1384
1374
// The field under validation must be present and not empty only when all of the other specified fields are not present.
1385
1375
funcrequiredWithoutAll(flFieldLevel) bool {
1386
-
1387
-
isValidateCurrentField:=true
1388
1376
params:=parseOneOfParam2(fl.Param())
1389
1377
for_, param:=rangeparams {
1390
-
1391
-
ifrequireCheckFieldKind(fl, param) {
1392
-
isValidateCurrentField=false
1378
+
ifrequireCheckFieldKind(fl, param, true) {
1379
+
returntrue
1393
1380
}
1394
1381
}
1395
-
1396
-
ifisValidateCurrentField {
1397
-
returnrequireCheckFieldKind(fl, "")
1398
-
}
1399
-
1400
-
returntrue
1382
+
returnhasValue(fl)
1401
1383
}
1402
1384
1403
1385
// 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.
0 commit comments