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

feat: standardization/unification for Query #1265

Open
flymedllva opened this issue Jun 9, 2024 · 4 comments
Open

feat: standardization/unification for Query #1265

flymedllva opened this issue Jun 9, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@flymedllva
Copy link

Feature Request

I want to write a wrapper package that uses Execute/ReadRow/ReadResultSet from Session and TxActor, encountered that the signature of the methods became very different

  1. options package is imported from internal, so I cannot describe a partial interface consisting of 1 method.
  2. for Session & TxActoroptions have become different – ExecuteOption & TxExecuteOption, which prevents you from using 1 interface for them
  3. I don't like the fact that the Execute call in Session gives Transaction, because of this method signature is different from TxActor, which does not allow to use 1 interface, as I used to do with database/sql. That said, I understand the idea of needing to return Transaction, but maybe in TxActor, it should also be returned?
Screenshot 2024-06-09 at 17 55 25
@flymedllva flymedllva added the enhancement New feature or request label Jun 9, 2024
@asmyasnikov
Copy link
Member

Some options for query session Execute not aplliable to transaction Execute
For example: query session Execute allowed option tx control for define isolation level on start transaction and auto-commit flag, but transaction already opened early and tx control is wrong option
Thats why options are different for session and transaction Execute.
But each option both allowed (session and transaction Execute) have a concrete type which compatible with options.ExecuteOption and options.TxExecuteOption

@flymedllva
Copy link
Author

flymedllva commented Jun 11, 2024

Some options for query session Execute not aplliable to transaction Execute
For example: query session Execute allowed option tx control for define isolation level on start transaction and auto-commit flag, but transaction already opened early and tx control is wrong option
Thats why options are different for session and transaction Execute.

Yes, that's understandable, but would like to understand this as a developer, while having a unified interface to be honest

But each option both allowed (session and transaction Execute) have a concrete type which compatible with options.ExecuteOption and options.TxExecuteOption

Having said that, the options are the same in Table(), yes you can see the difference in TransactionControl, but as a developer I would rather have the default behavior and have the options override this only for transaction start.

Screenshot 2024-06-11 at 20 13 30 Screenshot 2024-06-11 at 20 13 55

I realize the idea was to give accurate state management tools, but compared to sql/database && pgx it's awkward, they have very similar interfaces with and without transaction.

@flymedllva
Copy link
Author

What's the answer to that question?

  1. options package is imported from internal, so I cannot describe a partial interface consisting of 1 method.

@asmyasnikov
Copy link
Member

Having said that, the options are the same in Table(), yes you can see the difference in TransactionControl, but as a developer I would rather have the default behavior and have the options override this only for transaction start.

In Table service I made some design issues, which I tried to fix in Query service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants