This commit is contained in:
2025-02-07 11:11:43 +03:00
parent e04dc42d2b
commit cbce7f434f
18 changed files with 144 additions and 47 deletions

View File

@@ -378,6 +378,21 @@ func chipsetValidator(fe validator.FieldLevel) bool {
return IsInSlice(fieldValue, chipsetValues)
}
func preferredCPUValidator(fe validator.FieldLevel) bool {
fieldSlice, ok := fe.Field().Interface().([]int64)
if !ok {
return false
}
for _, value := range fieldSlice {
if value < -1 {
return false
}
}
return true
}
// ValidateRAM checks if request contains RAM value that is positive integer divisible by divisibility passed.
// It is recommended to pass constants.RAM_DIVISIBILITY as divisility arguement
func ValidateRAM(r interfaces.RequestWithRAM, divisibility uint64) error {