Constraint | Description | Example |
---|---|---|
blank | Validates that a String value is not blank |
|
creditCard | Validates that a String value is a valid credit card number |
|
| Validates that a String value is a valid email address. |
|
inList | Validates that a value is within a range or collection of constrained values. |
|
matches | Validates that a String value matches a given regular expression. |
|
max | Validates that a value does not exceed the given maximum value. |
|
maxSize | Validates that a value’s size does not exceed the given maximum value. |
|
min | Validates that a value does not fall below the given minimum value. |
|
minSize | Validates that a value’s size does not fall below the given minimum value. |
|
notEqual | Validates that that a property is not equal to the specified value |
|
nullable | Allows a property to be set to |
|
range | Uses a Groovy range to ensure that a property’s value occurs within a specified range |
|
scale | Set to the desired scale for floating point numbers (i.e. | the number of digits to the right of the decimal point). |
| size | Uses a Groovy range to restrict the size of a collection or number or the length of a String. |
| unique | Constrains a property as unique at the database level |
| url | Validates that a String value is a valid URL. |
| validator | Adds custom validation to a field. |
Grails4 domain 所有的约束都有哪些
最新推荐文章于 2020-09-10 11:50:53 发布