Skip to content

Commit

Permalink
greater/greaterEq/less/lessEq functions with EntityID parameter #619
Browse files Browse the repository at this point in the history
  • Loading branch information
Tapac committed Aug 28, 2019
1 parent fbe9f75 commit b1ab06b
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object SqlExpressionBuilder {
return EqOp(this, wrap(t))
}

infix fun <T:Comparable<T>> Column<EntityID<T>>.eq(t: T?) : Op<Boolean> {
infix fun <T:Comparable<T>> ExpressionWithColumnType<EntityID<T>>.eq(t: T?) : Op<Boolean> {
if (t == null) {
return isNull()
}
Expand All @@ -86,7 +86,7 @@ object SqlExpressionBuilder {
return NeqOp(this, wrap(other))
}

infix fun <T:Comparable<T>> Column<EntityID<T>>.neq(t: T?) : Op<Boolean> {
infix fun <T:Comparable<T>> ExpressionWithColumnType<EntityID<T>>.neq(t: T?) : Op<Boolean> {
if (t == null) {
return isNotNull()
}
Expand All @@ -101,18 +101,30 @@ object SqlExpressionBuilder {

infix fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.less(t: T) : Op<Boolean> = LessOp(this, wrap(t))

@JvmName("lessEntityID")
infix fun<T:Comparable<T>> ExpressionWithColumnType<EntityID<T>>.less(t: T) : Op<Boolean> = LessOp(this, wrap(t))

fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.less(other: Expression<S>) = LessOp(this, other)

infix fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.lessEq(t: T) : Op<Boolean> = LessEqOp(this, wrap(t))

@JvmName("lessEqEntityID")
infix fun<T:Comparable<T>> ExpressionWithColumnType<EntityID<T>>.lessEq(t: T) : Op<Boolean> = LessEqOp(this, wrap(t))

fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.lessEq(other: Expression<S>) : Op<Boolean> = LessEqOp(this, other)

infix fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.greater(t: T) : Op<Boolean> = GreaterOp(this, wrap(t))

@JvmName("greaterEntityID")
infix fun<T:Comparable<T>> ExpressionWithColumnType<EntityID<T>>.greater(t: T) : Op<Boolean> = GreaterOp(this, wrap(t))

fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.greater(other: Expression<S>) : Op<Boolean> = GreaterOp(this, other)

infix fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.greaterEq(t: T) : Op<Boolean> = GreaterEqOp(this, wrap(t))

@JvmName("greaterEqEntityID")
infix fun<T:Comparable<T>> ExpressionWithColumnType<EntityID<T>>.greaterEq(t: T) : Op<Boolean> = GreaterEqOp(this, wrap(t))

fun<T:Comparable<T>, S: T?> ExpressionWithColumnType<in S>.greaterEq(other: Expression<T>) : Op<Boolean> = GreaterEqOp(this, other)

operator fun<T, S: T> ExpressionWithColumnType<T>.plus(other: Expression<S>) : ExpressionWithColumnType<T> = PlusOp(this, other, columnType)
Expand Down

0 comments on commit b1ab06b

Please sign in to comment.