-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Adapter for Postgres.js #386
Comments
I'm interested in the same feature-- We could maybe do something like #398 for this, but it would require more work and scoping. |
Hello! |
Would also make heavy use of this adapter for our project. |
I'd love to use this! Any way I can help on the PR? |
A first version has been implemented via #411 , released as This was a tough one, mainly because Postgres.js does not offer any simple way to hook query execution. I had to emulate a postgres db socket (that can be fed to postgres.js) ... luckily, my preliminary works on pg-server for Primsa support was about exacly that, so this was a good first step. 👉 As far as I can tell, postgres.js seems to work:
import { newDb } from 'pg-mem';
// init db
const db = newDb();
const sql = db.adapters.createPostgresJsTag() as import('postgres').Sql;
await sql`create table test(name text)`;
await sql`insert into test values ('Alice'), ('Bob')`;
const pattern = 'A%';
const results = [...await sql`select * from test where name like ${pattern}`];
console.log(results);
// prints [{ name: "Alice", }]
see unit tests here |
This may be user error, but I'm having trouble with the Note that both execution with the Typescript compiler (
Haven't had a chance to dig too deeply into this yet FWIW so it may be a config issue |
@smcclure17 are you using ESM? I am also having this issue, and I think that is probably what is causing it. I've done a little investigating by adding printouts and this seems to be what is wrong:
But I'm not sure why. |
Would it be possible to have an adapter for the Postgres.js library?
https://github.com/porsager/postgres
The text was updated successfully, but these errors were encountered: