Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 01, 2012
@jorgeortiz85 jorgeortiz85 Forward port of 6f722ad
Type aliases and empty queries
d6cbf09
@jorgeortiz85 jorgeortiz85 Forward port f5bc0d7
Cross-build version order and asDBObject
589452a
View
2  project/RogueBuild.scala
@@ -15,7 +15,7 @@ object RogueBuild extends Build {
lazy val defaultSettings: Seq[Setting[_]] = Seq(
version := "1.1.4-SNAPSHOT",
organization := "com.foursquare",
- crossScalaVersions := Seq("2.8.1", "2.9.0", "2.9.0-1", "2.9.1", "2.8.0"),
+ crossScalaVersions := Seq("2.9.1", "2.9.0-1", "2.9.0", "2.8.1", "2.8.0"),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
View
5 rogue-core/src/main/scala/com/foursquare/rogue/Query.scala
@@ -216,6 +216,9 @@ case class BaseQuery[
override def toString: String =
MongoBuilder.buildQueryString("find", collectionName, this)
+ def asDBObject: DBObject =
+ MongoBuilder.buildCondition(this.condition)
+
def signature(): String =
MongoBuilder.buildSignature(collectionName, this)
@@ -574,6 +577,8 @@ case class BaseModifyQuery[M](
addClauseOpt(opt)(clause)
override def toString: String = MongoBuilder.buildModifyString(query.collectionName, this)
+
+ def asDBObject = (this.query.asDBObject, MongoBuilder.buildModify(this.mod))
}
// *******************************************************
View
4 rogue-core/src/main/scala/com/foursquare/rogue/Rogue.scala
@@ -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, _, _, _, _, _]
View
2  rogue-core/src/main/scala/com/foursquare/rogue/package.scala
@@ -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]
+
}
View
18 rogue-lift/src/test/scala/com/foursquare/rogue/QueryTest.scala
@@ -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

No commit comments for this range

Something went wrong with that request. Please try again.