Created
April 21, 2012 11:11
-
-
Save hexx/2436654 to your computer and use it in GitHub Desktop.
Google App Engine Low Level API Query Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.JavaConverters._ | |
import com.google.appengine.api.datastore.Query | |
import com.google.appengine.api.datastore.Query.FilterOperator._ | |
import com.google.appengine.api.datastore.Query.SortDirection._ | |
val q = new Query(kind) | |
q.addFilter("age", GREATER_THAN_OR_EQUAL, 10) | |
q.addFilter("age", LESS_THAN_OR_EQUAL, 20) | |
q.addSort("age", ASCENDING) | |
q.addSort("name", ASCENDING) | |
val ps = for (e <- ds.prepare(q).asIterator.asScala) yield { | |
Person(e.getProperty("name").asInstanceOf[String], e.getProperty("age").asInstanceOf[Long]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment