Created
July 15, 2016 23:14
-
-
Save moxley/1e8c48a6dab31788b181facfc1f8851b to your computer and use it in GitHub Desktop.
Build query dynamically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test "query with multiple WHEREs" do | |
query = | |
Easy.from({HomeAssessment, :ha}) | |
|> Easy.where({:>=, [ha: :id], 1}) | |
|> Easy.where({:<=, [ha: :id], 10}) | |
|> Easy.build_query | |
assert inspect(query) == inspect(Q.from(ha in HomeAssessment, where: ha.id >= 1, where: ha.id <= 10)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment