maxLength
mach::FieldValidationBuilder::maxLength
Adds maximum length validation.
Description
Section titled “Description”Applies a maximum length validation rule to a string field.
Syntax
Section titled “Syntax”FieldValidationBuilder& maxLength(std::size_t maxLength);Return Value
Section titled “Return Value”A reference to the current FieldValidationBuilder instance.
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
maxLength |
The maximum allowed length. |
Remarks
Section titled “Remarks”Applying the same validation rule multiple times is allowed.
Thread Safety
Section titled “Thread Safety”This method is not thread-safe and should only be called during validation configuration.
Example
Section titled “Example”void validate(mach::ValidationBuilder<User>& validation) const { validation.field(&User::name) .maxLength(50);}See Also
Section titled “See Also”| Name | Description |
|---|---|
length |
Adds length validation. |
minLength |
Adds minimum length validation. |