equals
mach::FieldValidationBuilder::equals
Adds equality validation.
Description
Section titled “Description”Applies an equality validation rule to a field.
Syntax
Section titled “Syntax”template <typename U>FieldValidationBuilder& equals(U&& value);Return Value
Section titled “Return Value”A reference to the current FieldValidationBuilder instance.
Template Parameters
Section titled “Template Parameters”| Parameter | Description |
|---|---|
U |
The type of the value to compare the field with. |
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
value |
The value the field must equal. |
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::role) .equals("admin");}See Also
Section titled “See Also”| Name | Description |
|---|---|
notEquals |
Adds inequality validation. |