-
Notifications
You must be signed in to change notification settings - Fork 881
Rogue Examples converted
John Tims edited this page Mar 13, 2015
·
1 revision
Some examples how Rogue queries could be expressed with Querydsl with the coming Querydsl scala syntax :
// Rogue
Checkin where (_.venueid eqs id)
and (_.userid eqs mayor.id)
and (_.cheat eqs false)
and (_._id after sixtyDaysAgo)
select(_._id) fetch()
//Querydsl
Checkin.where(_.venueid eq id).where(_.userid eq mayour.id).where(_cheat eq false).select(_.id)
// Rogue
VenueRole where (_.venueid eqs this.id)
and (_.userid eqs userid)
modify (_.role_type setTo RoleType.manager)
upsertOne()
// ?!?
// Rogue
Venue where (_.mayor eqs 1234)
Venue where (_.mayor eqs 1234) and (_.popularity eqs 5)
// Querydsl
Venue.where(_.mayour eq 1234)
Venue.where(_.mayour eq 1234) and (_.popularity eq 5)
// Rogue
Venue where (_.venuename startsWith "Starbucks")
and (_.mayor in List(1234, 5678))
// Querydsl
Venue.where(_.venuename startsWith("Starbucks").where(_.mayour in(1234,5678))
source of examples : http://engineering.foursquare.com/2011/01/21/rogue-a-type-safe-scala-dsl-for-querying-mongodb/