CountableRange.contains(): turn 0..<10.contains(x) to "x >= 0 AND x < 10" instead of "x BETWEEN 0 AND 9" (and avoid Int ranges to mess with double values)

This commit is contained in:
Gwendal Roué committed 2016-10-21 09:14:19 +02:00
1 parent 9ae2de6dc1
commit c4dfd24782
1 file changed
+1 -1
@@ -528,7 +528,7 @@ extension CountableRange where Bound: SQLExpressible {
/// // id BETWEEN 1 AND 9
/// (1..<10).contains(Column("id"))
public func contains(_ element: SQLSpecificExpressible) -> SQLExpression {
return SQLExpressionBetween(element.sqlExpression, lowerBound.sqlExpression, upperBound.advanced(by: -1).sqlExpression)
return (element >= lowerBound) && (element < upperBound)
}
}