-
-
Save kciesielski/26f4278ddd6d6b513e0e to your computer and use it in GitHub Desktop.
This file contains 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
def loadUser(searchedNameOpt: Option[String], searchedAgeOpt: Option[Int]) = { | |
val getAllQuery = (UserRecord limit 5 orderDesc (_.age)).query | |
val queryByName = searchedNameOpt map(searchedName => getAllQuery where (_.name eqs searchedName)) getOrElse getAllQuery | |
val finalQuery = searchedAgeOpt map(searchedAge => queryByName and(_.age eqs searchedAge)) getOrElse queryByName | |
finalQuery fetch() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment