evadne / etso

Ecto 3 adapter allowing use of Ecto schemas held in ETS tables
https://hexdocs.pm/etso
Apache License 2.0
377 stars 36 forks source link

Support JSON extract path expression #20

Closed heywhy closed 2 years ago

heywhy commented 2 years ago

Previously, queries that check against JSON columns couldn't be used alongside this adapter. With the changes in this PR, we can now do this. see an example below:

from(e in Model.Employee)
|> where([e], e.metadata["twitter"] == "@andrew_fuller")
|> Repo.one!()

Also, a function called flush_tables was added to the adapter module to allow us to drop all data in a repository considering some tests might pollute the database and we have no way to implement postgres-like partitioning at the moment.

evadne commented 2 years ago

@heywhy Thank you very much, I am reviewing this now.

evadne commented 2 years ago

@heywhy FYI, reconstructing branch as your changes were from 0.1.6 and included undesired cross merge from master 1.0.1 so history needs to be refactored.

evadne commented 2 years ago

Reconstitution of WIP @ feature/gh-20-json-extract-path

evadne commented 2 years ago

@heywhy Please retest branch feature/gh-20-json-extract-path @ 31f2c3c, then pull this to your fork (fast forward only, do not create merge commits), then revise the working branch in this PR to allow correct attribution via GitHub history.

Please note active_tables is removed, you should do the following instead,

for model <- [ModelA, ModelB] do
  Repo.delete_all(model)
end

As I have implemented delete_all support.

evadne commented 2 years ago

@heywhy do not push to develop, use the same branch I published and revise this PR to use that branch to conform to merge requirements.

heywhy commented 2 years ago

@heywhy do not push to develop, use the same branch I published and revise this PR to use that branch to conform to merge requirements.

That's a mistake on my end. I thought you wanted the commits squashed or something. I will close this PR and create a new PR from the other branch as everything from the other branch works as expected.

evadne commented 2 years ago

Yes that would be good though name the branch with feature/gh-21 or so. @heywhy

heywhy commented 2 years ago

Also, can you have a part in the readme that tells contributors what merge strategy should be used so as to avoid a situation like mine?