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

Add API that exposes the protocol response without parsing #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shadaj
Copy link

@shadaj shadaj commented Apr 20, 2024

This can be useful when using pglite with code that already has its own parsing logic.

@samwillis
Copy link
Collaborator

samwillis commented Apr 21, 2024

Hey @shadaj

I considered this when first implementing the execProtocol method but we need to do some level of parsing for error handling internally and watching for the shutdown message. We should revisit this though as there is probably a more efficient route.

I will take a good look later this week.

@shadaj
Copy link
Author

shadaj commented Apr 25, 2024

Ah, yeah. In my use case I am bridging this to a WASM module that only knows how to speak the wire protocol, so I ran into trouble when execProtocol throws an exception afte parsing out an error since I have no way of recovering the original bytes. So currently I am just patching pglite to not throw that exception, which works reasonably well.

Could there maybe be two layers to the API? One that deals directly at the protocol level and doesn't try to do anything smart wrt managing transactions and parsing errors, and one that layers the JS-friendly API on top?

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.

None yet

2 participants