A method expression is made up of the prefixes: findBy, findAllBy, countBy
followed by the expression that combines a query upon one or more properties:
User.findBy{property}[Conditional=equal][Operator]?{property}[Conditional][Operator]
User.findAllBy{property}[Conditional=equal][Operator]?{property}[Conditional][Operator]
User.countBy{property}[Conditional=equal][Operator]?{property}[Conditional][Operator]
If a conditional keyword is not passed, we assume you want equality. Remember that!
{% hint style="danger" %} IMPORTANT: The ? means that you can concatenate the same pattern over and over again. {% endhint %}
The available conditionals in ColdBox are:
LessThanEquals
- Less than or equal to passed valueLessThan
- Less than to passed valueGreaterThanEquals
- Greater than or equal to passed valueGreaterThan
- Greater than to passed valueLike
- Equivalent to the SQL like expressionNotEqual
- Not equal to the passed valueisNull
- The property must be nullisNotNull
- The property must not be nullNotBetween
- The property value must not be between two valuesBetween
- The property value must be between two valuesNotInList
- The property value must not be in the passed in simple list or arrayinList
- The property value must be in the passed in simple list or array
The only valid operators are:
And
Or