Skip to content

chore: accept a counter option in prepare_query/3#4714

Open
zachdaniel wants to merge 4 commits intoelixir-ecto:masterfrom
zachdaniel:merge-support
Open

chore: accept a counter option in prepare_query/3#4714
zachdaniel wants to merge 4 commits intoelixir-ecto:masterfrom
zachdaniel:merge-support

Conversation

@zachdaniel
Copy link
Copy Markdown
Contributor

No description provided.

@greg-rychlewski
Copy link
Copy Markdown
Member

Out of curiosity what problem does this solve?

@josevalim
Copy link
Copy Markdown
Member

@zachdaniel is implementing MERGE, which is basically multiple insert, update, etc. queries spliced into one.

{query, params, key} = plan(query, operation, adapter)
{cast_params, dump_params} = Enum.unzip(params)
key = if query_cache?, do: key, else: :nocache
key = if query_cache?, do: {key, counter}, else: :nocache
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zachdaniel I thought it would be better to always add the counter, to reduce the number of branches, but it seems that either using a list is wrong or we are messing with the key in an incompatible way. Can you please take a deeper look?

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.

3 participants