Skip to content
Download

equals

mach::FieldValidationBuilder::equals

Adds equality validation.

Applies an equality validation rule to a field.

template <typename U>
FieldValidationBuilder& equals(U&& value);

A reference to the current FieldValidationBuilder instance.

Parameter Description
U The type of the value to compare the field with.
Parameter Description
value The value the field must equal.

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::role)
.equals("admin");
}
Name Description
notEquals Adds inequality validation.