-
Notifications
You must be signed in to change notification settings - Fork 203
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
Feature request: Expose client instance via postgres:// protocol #38
Comments
Great idea! Once we swap to using the pg wire protocol for all I/O (#31, with #17 laying the foundations for input) it should be relatively easy to wrap pglite in a node socket server to make it appear as a pg instance. Key thing to note though is that PGlite is single process/user, so multiple connections wouldn't be supported. With a socket server we would probably want to enforce this, but that's also probably fine for tests. |
Lovely, looking forward to this! Currently, there's no easy way to test PostgREST other than mocking on the network layer (eg. with Being able to have something that could create in-memory instance + expose it's connection would definitely allow us to write better testing infrastructure (that I'll be more than happy to open-source afterwords as well :)). |
#39 introduces full IO using the PG protocol and exposes a Note that it won't do the initial connect/auth handshake, that will probably need to be simulated. |
Strongly need the feature of supporting "postgres:// protocol" ... |
@samwillis it's only beginning, but thanks to an awesome post from @GavinRay97 (thanks!), I managed to make I'll see how much I can push it, and in the future, we can work on wiring it up to the https://gist.github.com/kamilogorek/fdba0412e4f1c0b582da99c511cc0a42 |
Added playground repo for reference https://github.com/kamilogorek/pglite-server |
Aaaand it's live :) - https://www.npmjs.com/package/pglite-server |
Thanks @kamilogorek for this great implementation ❤️ I tested it out for a local development setup and it was mostly working with
I'm guessing that this is due to protocol changes coming up in 0.2? I'm just leaving this here for now instead of opening an issue as I know that |
@BracketJohn take a look at https://github.com/supabase-community/pg-gateway which is way more powerful and works with |
Oh wow, thanks @kamilogorek - also very nice of you to point to an alternate package that you have not implemented (: Thanks a ton 💯 ❤️ |
fyi @kamilogorek: there was an interesting possible limitation I found in |
Not sure exactly how to go about this yet, but it would be great if we could create in-memory, or temporary local instances of Postgres and marry it together with Postgrest https://postgrest.org/en/v12/
This way you can have an trivial REST API setup _or _ like in my case, allow for creating fully replicable test environment for your unit/e2e tests.
The text was updated successfully, but these errors were encountered: