Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append query options to context instead of overwriting. #860

Merged
merged 4 commits into from
Dec 22, 2022

Conversation

aaron276h
Copy link
Contributor

Previously every time clickhouse.Context(context.Context, QueryOption) is called multiple times on the same context object, only the query options in the last call would used. For example:

ctx := Context(context.Background(), WithQueryID("a"))
ctx = Context(ctx, WithQuotaKey("b"))

would not persist the the query id.

This PR changes the clickhouse.Context() logic to first attempt to load the existing QueryOptions when called so that query options append instead of overwrite existing ones.

It is possible that this is a breaking change for users that have become dependent on this behavior, however it is unlikely that someone is purposefully depending on it today.

@CLAassistant
Copy link

CLAassistant commented Dec 22, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@jkaflik jkaflik left a comment

Choose a reason for hiding this comment

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

Looks good. There is one minor we could have done.
Please let me know.

context_test.go Outdated Show resolved Hide resolved
context_test.go Outdated Show resolved Hide resolved
@jkaflik jkaflik merged commit 69f8366 into ClickHouse:main Dec 22, 2022
@jkaflik
Copy link
Contributor

jkaflik commented Dec 22, 2022

@aaron276h thanks! it will be included in upcoming v2.5 release

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