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

kotlin: add Query class to support timeout and cancellation #368

Merged
merged 2 commits into from
Mar 1, 2020

Conversation

mightyguava
Copy link
Contributor

@mightyguava mightyguava commented Feb 28, 2020

There's now a sqlc.runtime package containing a few abstract classes implemented by the each query method. The query methods now return these intermediate classes rather than executing the query directly. You have to now explicitly call .execute() on the return value. I don't really like this level of indirection, but it now makes it possible to set timeouts at the per-query level, and allows queries to be canceled. It also opens up the possibility of "interceptors" for query objects that can be used to apply additional common code.

The runtime library is at https://github.com/kyleconroy/sqlc-kotlin-runtime. I haven't published it to maven yet. It's kinda complicated and will take some time. So the runtime is checked in to this repo in the meantime to let tests pass.

@mightyguava
Copy link
Contributor Author

cc: @ryanhall07 @tirsen @swankjesse PTAL

There's now a `sqlc.runtime` package containing a few abstract classes implemented by the each query method. The query methods now return these intermediate classes rather than executing the query directly. You have to now explicitly call `.execute()` on the return value. I don't really like this level of indirection, but it now makes it possible to set timeouts at the per-query level, and allows queries to be canceled. It also opens up the possibility of "interceptors" for query objects that can be used to apply additional common code.
@mightyguava
Copy link
Contributor Author

@kyleconroy fyi i'm setting up the artifact hosting, let me know if you want to make an account for yourself https://issues.sonatype.org/browse/OSSRH-55459

@kyleconroy kyleconroy merged commit 463dc8a into sqlc-dev:master Mar 1, 2020
@mightyguava mightyguava deleted the kotlin-runtime branch March 2, 2020 16:27
mightyguava added a commit to mightyguava/sqlc that referenced this pull request Nov 9, 2020
The runtime in sqlc-dev#368 turned out to
be a bad idea. It's pretty much unnecessary and adds quite a bit to the
complexity of the generated code. It's _possible_ a runtime would be
useful in the future. At that point we can add that back in
mightyguava added a commit to mightyguava/sqlc that referenced this pull request Nov 9, 2020
The runtime in sqlc-dev#368 turned out to
be a bad idea. It's pretty much unnecessary and adds quite a bit to the
complexity of the generated code. It's _possible_ a runtime would be
useful in the future. At that point we can add that back in
mightyguava added a commit to mightyguava/sqlc that referenced this pull request Nov 9, 2020
The runtime in sqlc-dev#368 turned out to
be a bad idea. It's pretty much unnecessary and adds quite a bit to the
complexity of the generated code. It's _possible_ a runtime would be
useful in the future. At that point we can add that back in
kyleconroy pushed a commit that referenced this pull request Nov 14, 2020
The runtime in #368 turned out to
be a bad idea. It's pretty much unnecessary and adds quite a bit to the
complexity of the generated code. It's _possible_ a runtime would be
useful in the future. At that point we can add that back in
eliteprodev pushed a commit to eliteprodev/safesql_generator that referenced this pull request May 17, 2023
The runtime in sqlc-dev/sqlc#368 turned out to
be a bad idea. It's pretty much unnecessary and adds quite a bit to the
complexity of the generated code. It's _possible_ a runtime would be
useful in the future. At that point we can add that back in
eliteprodev added a commit to eliteprodev/safesql_generator that referenced this pull request Jun 26, 2023
The runtime in sqlc-dev/sqlc#368 turned out to
be a bad idea. It's pretty much unnecessary and adds quite a bit to the
complexity of the generated code. It's _possible_ a runtime would be
useful in the future. At that point we can add that back in
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