Skip to content

Instantly share code, notes, and snippets.

Created July 21, 2016 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/64da1b8df3309db08811c113736353c5 to your computer and use it in GitHub Desktop.
Save anonymous/64da1b8df3309db08811c113736353c5 to your computer and use it in GitHub Desktop.
the description for this gist
/* Quill's infix mechanism */
implicit class ForUpdate[T](q: Query[T]) {
def forUpdate = quote(infix"$q FOR UPDATE".as[Query[T]])
}
val a = quote {
users.filter(u => u.isActive == true).forUpdate
}
/* Slick's raw query */
sql"""
SELECT * FROM (SELECT * FROM users u WHERE u.is_active = true FOR UPDATE) u
""".as[(Long, String, Boolean))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment