Created
October 24, 2019 14:08
-
-
Save maexrakete/a99c6c5cc180bcde0423452045cb7282 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 findPaged(limit: Int, offset: Int)( | |
implicit filter: Option[IssueSortAndFilterOptions] = None) | |
: Future[Page[Issue]] = { | |
db.run( | |
(for { | |
data <- filteredQuery(filter) | |
.sortBy { a => | |
filter.flatMap(_.term) match { | |
case Some(search) => a.title <<-> search | |
case None => ??? | |
} | |
} | |
.drop(offset) | |
.take(limit) | |
.result | |
total <- filteredQuery.length.result | |
} yield | |
(Page(totalEntities = total, | |
data = data, | |
currentPage = offset / limit, | |
pageSize = limit)))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment