Skip to content
Download

minLength

mach::FieldValidationBuilder::minLength

Adds minimum length validation.

Applies a minimum length validation rule to a string field.

FieldValidationBuilder& minLength(std::size_t minLength);

A reference to the current FieldValidationBuilder instance.

Parameter Description
minLength The minimum allowed length.

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<User>& validation) const {
validation.field(&User::name)
.minLength(3);
}
Name Description
length Adds length validation.
maxLength Adds maximum length validation.