Skip to content
Download

max

mach::FieldValidationBuilder::max

Adds maximum value validation.

Applies a maximum value validation rule to a numeric field.

template <typename Number>
FieldValidationBuilder& max(Number maximum);

A reference to the current FieldValidationBuilder instance.

Parameter Description
Number The numeric type of the maximum value.
Parameter Description
maximum The maximum allowed value.

Applying the same validation rule multiple times is allowed.

This method is not thread-safe and should only be called during validation configuration.

void validate(mach::ValidationBuilder<Product>& validation) const {
validation.field(&Product::price)
.max(1000);
}
Name Description
range Adds range validation.
min Adds minimum value validation.
multipleOf Adds multiple-of validation.