isoos / postgresql-dart

Dart PostgreSQL driver: supports extended query format, binary protocol and statement reuse.
https://pub.dev/packages/postgres
BSD 3-Clause "New" or "Revised" License
129 stars 36 forks source link

value decoding (and encoding) needs additional access #346

Open isoos opened 2 months ago

isoos commented 2 months ago

My hesitance to go ahead with #342 and also with #343 has the same root: in their current form, they seem to be adding non-trivial complexity that could become barriers for the future improvements, while in the ideal world such features should be added with much less friction and much less interconnectedness.

After a some thinking and high-level fiddling, I think I have found a way forward though: we will need to refactor the value encoding/decoding to have access to:

I'm not entirely sure how such code would look like, but I think the above feature would now only allow the two pending features to go ahead, but also allow better overall extensibility.

/cc @insinfo @wolframm

isoos commented 2 months ago

I think the OID cache part has a clean separation from the rest. The other big change would be the decoding becoming async/FutureOr because of the potential need for OID type description query. It seems to be not breaking though.

isoos commented 1 month ago

I think this is now implemented, alongside with custom codec registration.

/cc @insinfo @wolframm: I've released a 3.4.0-dev.1 prerelease version with it, I think the API is good enough now, and you can go ahead with the PRs. Please let me know if there is something missing or in conflict with the goals.

isoos commented 1 month ago

Note: I've released 3.4.0-dev.2 with now with likely future-proofed async-enabled codec API (+ related message processing). Please, if possible, test and give me feedback before committing to a final version on it.

insinfo commented 1 month ago

Hi, I had an accident and will be away from programming for a while. It would be great if you could implement timezone support based on my implementation with the modifications you introduced. Congratulations on your work.

isoos commented 1 month ago

@insinfo: I'm planning to help you out with the implementation, however I won't have the bandwidth for that in the next week or so. Because of that I've published 3.4.0 as-is, and we shall figure out the details for your use-case later, I'm rather optimistic that everything need is in it.