Skip to content

Instantly share code, notes, and snippets.

@vrymel
Created December 25, 2017 13:20
Show Gist options
  • Save vrymel/57c17faf268a1e5225ce2a643aa3fce0 to your computer and use it in GitHub Desktop.
Save vrymel/57c17faf268a1e5225ce2a643aa3fce0 to your computer and use it in GitHub Desktop.
Elixir: using custom where statement with database build function calls
query = from i in Intersection,
where: i.lat >= 100.0 or i.lat <= 200.0,
where: i.lng >= 200.0 or i.lng <= 400.0,
where: fragment("acos(sin(?) * sin(lat) + cos(?) * cos(lat) * cos(lng - (?))) <= ?", 1, 2, 3, 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment