Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private val PARSER = long("id")~str("email")~str("password_hash")~
- bool("locked")~date("created_on")~date("last_login") map {
- case a~b~c~d~e~f => User(a, b, c, d, new DateTime(e), new DateTime(f), PaymentProcessor.fetchBlocking(a))
- }
- private val FETCH_BY_ID = "SELECT * FROM users WHERE `id` = {id}"
- def fetch(id: Long): Future[Option[User]] = Future { fetchBlocking(id) }
- def fetchBlocking(id: Long): Option[User] = DB.withConnection(c => fetchBlockingC(id)(c))
- def fetchBlockingC(id: Long)(implicit c: Connection): Option[User] =
- SQL(FETCH_BY_ID).on('id -> id).as(PARSER *).headOption
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement