Skip to content

Instantly share code, notes, and snippets.

@cheptsov
Last active December 20, 2015 16:49
Show Gist options
  • Save cheptsov/6164062 to your computer and use it in GitHub Desktop.
Save cheptsov/6164062 to your computer and use it in GitHub Desktop.
Type-safe inner join via Exposed library
(Users.name + Users.cityId * Cities.name).filter { Users.id.equals("andrey") } forEach {
val (userName, cityName) = it
println("$userName lives in $cityName")
}
@cheptsov
Copy link
Author

cheptsov commented Aug 6, 2013

Generates:

SELECT Users.name, Cities.name FROM Users INNER JOIN Cities ON Cities.id = Users.city_id WHERE Users.id = 'andrey'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment