mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1634 - ENH: Add convenience expressions "greater than or null" gtOrNull(), ltOrNull() and inRangeWith()
This commit is contained in:
@@ -221,6 +221,11 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
return new InRangeExpression(propertyName, value1, value2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression inRangeWith(String lowProperty, String highProperty, Object value) {
|
||||
return and(le(lowProperty, value), gtOrNull(highProperty, value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Between - property between the two given values.
|
||||
*/
|
||||
@@ -245,6 +250,14 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
return new SimpleExpression(propertyName, Op.GT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater Than or null - property greater than the given value or null.
|
||||
*/
|
||||
@Override
|
||||
public Expression gtOrNull(String propertyName, Object value) {
|
||||
return or(gt(propertyName, value), isNull(propertyName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater Than or Equal to - property greater than or equal to the given
|
||||
* value.
|
||||
@@ -254,6 +267,14 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
return new SimpleExpression(propertyName, Op.GT_EQ, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Less Than or null - property less than the given value or null.
|
||||
*/
|
||||
@Override
|
||||
public Expression ltOrNull(String propertyName, Object value) {
|
||||
return or(lt(propertyName, value), isNull(propertyName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Less Than - property less than the given value.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user