CustomValidation

Creates a custom validator attribute. Note that due to a linker bug func cannot be a lambda.

Members

Functions

validate
bool validate(T value)
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

validator
enum validator;
Undocumented in source.

Variables

args
Parameters!func[1..$] args;
Undocumented in source.
message
string message;
Undocumented in source.

Examples

// validates only if the value is equals to `test`, case insensitive
bool validateExp(string value) {
   import std.string : toLower;
   return value.toLower() == "test";
}
alias Test = CustomValidation!validateExp;
...
struct Form {

   @Test
   string test;

}

Meta