Skip to content

Conversation

curi1119
Copy link
Contributor

@curi1119 curi1119 commented Jul 1, 2020

This PR fixies where in query.

If use where in in Ecto like follow,

Model.Employee
  |> where([x], x.employee_id in ^[3, 5, 7])
  |> Repo.all()

Etso build ETS qeury like this.

{{:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$9", :"$10", :"$11"},
 [{:orelse, {:==, :"$1", nil}, {:==, :"$1", 3}}],
 [
   [:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$9", :"$10",
    :"$11"]
 ]}

This :orelse query is not expected.

Expected :orelse:

{{:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$9", :"$10", :"$11"},
 [{:orelse, {:==, :"$1", 7}, {:orelse, {:==, :"$1", 5}, {:==, :"$1", 3}}}],
 [
   [:"$1", :"$2", :"$3", :"$4", :"$5", :"$6", :"$7", :"$8", :"$9", :"$10",
    :"$11"]
 ]}

@evadne
Copy link
Owner

evadne commented Oct 2, 2020

This is very good. Thank you.

@evadne evadne changed the title fix where in query Fixed where/in query Oct 3, 2020
evadne added a commit that referenced this pull request Oct 3, 2020
- Closes #6: Support for where/in queries
@evadne evadne changed the title Fixed where/in query Support for where/in queries Oct 3, 2020
@evadne
Copy link
Owner

evadne commented Oct 3, 2020

Merged & Released in Etso 0.1.2.

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants