in app/domain/image/ImageRepository.scala [116:131]
def randomIds(limit: Int = 20): Future[Option[Seq[Int]]] = {
val action = sql"""
SELECT id FROM image
WHERE status = 1
ORDER BY random()
LIMIT 20
""".as[Int]
db.run(action).map {
case ids: Seq[Int] => Some(ids)
case _ => None
}.recover {
case e => {
None
}
}
}