Permalink
Browse files

Forward port of 6f722ad

Type aliases and empty queries
  • Loading branch information...
1 parent 2e3b565 commit d6cbf09bcafd94b31954ac206dfe5f6b493f7b0f @jorgeortiz85 jorgeortiz85 committed Apr 1, 2012
@@ -27,10 +27,6 @@ trait Rogue {
// type PaginatedQuery[T <: MongoRecord[T]] = BasePaginatedQuery[T, T]
- // type EmptyQuery[T <: MongoRecord[T]] =
- // BaseEmptyQuery[T, T, Unordered, Unselected, Unlimited, Unskipped, HasNoOrClause]
- type ModifyQuery[T] = AbstractModifyQuery[T]
-
type GenericQuery[M, R] = AbstractQuery[M, R, _, _, _, _, _]
type GenericBaseQuery[M, R] = BaseQuery[M, R, _, _, _, _, _]
@@ -13,7 +13,9 @@ package object rogue {
Or <: MaybeHasOrClause
] = BaseQuery[M, R, Ord, Sel, Lim, Sk, Or]
+ type ModifyQuery[T] = BaseModifyQuery[T]
type AbstractModifyQuery[M] = BaseModifyQuery[M]
type AbstractFindAndModifyQuery[M, R] = BaseFindAndModifyQuery[M, R]
+
}
@@ -524,14 +524,16 @@ class QueryTest extends SpecsMatchers {
def testQueryOptimizerDetectsEmptyQueries: Unit = {
val optimizer = new QueryOptimizer
- optimizer.isEmptyQuery(Venue where (_.mayor in List())) must_== true
- optimizer.isEmptyQuery(Venue where (_.tags in List())) must_== true
- optimizer.isEmptyQuery(Venue where (_.tags all List())) must_== true
- optimizer.isEmptyQuery(Venue where (_.tags contains "karaoke") and (_.mayor in List())) must_== true
- optimizer.isEmptyQuery(Venue where (_.mayor in List()) and (_.tags contains "karaoke")) must_== true
- optimizer.isEmptyQuery(Comment where (_.comments in List())) must_== true
- optimizer.isEmptyQuery(Venue where (_.mayor in List()) scan (_.mayor_count eqs 5)) must_== true
- optimizer.isEmptyQuery(Venue where (_.mayor in List()) modify (_.venuename setTo "fshq")) must_== true
+ optimizer.isEmptyQuery(Venue.where(_.mayor eqs 1)) must_== false
+ optimizer.isEmptyQuery(Venue.where(_.mayor in List())) must_== true
+ optimizer.isEmptyQuery(Venue.where(_.tags in List())) must_== true
+ optimizer.isEmptyQuery(Venue.where(_.tags all List())) must_== true
+ optimizer.isEmptyQuery(Venue.where(_.tags contains "karaoke").and(_.mayor in List())) must_== true
+ optimizer.isEmptyQuery(Venue.where(_.mayor in List()).and(_.tags contains "karaoke")) must_== true
+ optimizer.isEmptyQuery(Comment.where(_.comments in List())) must_== true
+ optimizer.isEmptyQuery(Venue.where(_.mayor in List()).scan(_.mayor_count eqs 5)) must_== true
+ optimizer.isEmptyQuery(Venue.where(_.mayor eqs 1).modify(_.venuename setTo "fshq")) must_== false
+ optimizer.isEmptyQuery(Venue.where(_.mayor in List()).modify(_.venuename setTo "fshq")) must_== true
}
@Test

0 comments on commit d6cbf09

Please sign in to comment.