Skip to content

Add done_query methods to query traits#265

Closed
d00z3l wants to merge 2 commits into
sunng87:masterfrom
d00z3l:master
Closed

Add done_query methods to query traits#265
d00z3l wants to merge 2 commits into
sunng87:masterfrom
d00z3l:master

Conversation

@d00z3l

@d00z3l d00z3l commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Hi @sunng87,

Another PR, this one adds done_query to the simple and extended handlers. The purpose is to allow clean up code to run after the query is successfully executed. I added default implementations so it doesn't break existing logic. Let me know if there is a better way to achieve this.

@sunng87

sunng87 commented Jun 6, 2025

Copy link
Copy Markdown
Owner

@d00z3l Thank you for patch. After thinking about the case, I would recommend you to override on_query in your trait implementation for this behaviour. Because

  1. Every method in simple/extended query handler is modeled by postgres messages. I feel that this type of query lifecycle callbacks should be at another level, like pre_query/post_query
  2. For query_done, in order to make it useful we need to provide more context in addition to client.

So I would recommend you to keep it in your own implementation for now until we find common cases that we can build this query lifecycle layers.

@d00z3l d00z3l closed this Jun 10, 2025
@sunng87

sunng87 commented Jul 23, 2025

Copy link
Copy Markdown
Owner

@d00z3l I just created a patch to address your concern in #287 . With this, you can override on_query and reference the default implementation with self._on_query(...), and add your own post_query logic in on_query.

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