Skip to content

Instantly share code, notes, and snippets.

@charmygarg
Created September 24, 2017 10:18
Show Gist options
  • Save charmygarg/606df1e138c7e57a029cc6995d33800a to your computer and use it in GitHub Desktop.
Save charmygarg/606df1e138c7e57a029cc6995d33800a to your computer and use it in GitHub Desktop.
def getAllUsers: Future[List[User]] = {
select
.fetch()
}
def getByid(id: String): Future[Option[String]] = {
select(_.name)
.where(_.id eqs id)
.allowFiltering()
.one()
}
def getByQuery(email: String, name: String): Future[Option[(String, Set[String])]] = {
select(_.id, _.email)
.where(_.email contains email)
.and(_.name eqs name)
.allowFiltering()
.one()
}
def getByidAndName(id: String): Future[List[User]] = {
update
.where(_.id eqs id)
.modify(_.name setTo "newUser")
.future()
getAllUsers
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment