Skip to content
Download

notEquals

mach::FieldValidationBuilder::notEquals

Adds inequality validation.

Applies an inequality validation rule to a field.

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

A reference to the current FieldValidationBuilder instance.

Parameter Description
U A type from which the field type can be constructed.
Parameter Description
value The value the field must not 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)
.notEquals("guest");
}
Name Description
equals Adds equality validation.