-
-
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
Deno support #262
Comments
This would be great, but I am not sure how much effort it would be to make it Deno compatible without publishing a new library. |
Closing, Deno is a non priority for now. |
For those poor souls that are looking into this: Just add this into your "imports": {
"@pgtyped/runtime": "npm:@pgtyped/[email protected]"
} This will remap the imports, and deno will be able to correctly fetch teh @pgtyped/runtime dependency. And, if you want to use the deno postgres client, this works for me: import { Client } from 'https://deno.land/x/[email protected]/mod.ts'
const client = new Client({
// ...
})
await client.connect()
const db = {
query(sql: string, bindings: any[]): Promise<{ rows: any[]}> {
return client.queryArray(sql, bindings)
}
}
/// later
const results = await queries.getUserOrSomething.run({ user_id: 0 }, db) and that's it! |
I just discovered this, so maybe there's a caveat? If it works, solving this issue would be as simple as mentioning in the docs that you should modify the |
Thank you! It would be fab if we could get this into the documenation |
Changes required to get codegen workingUnfortunately pgtyped 2.0 broke support for Deno because it started using Piscina which internally uses a nodejs There are two ways to solve this:
Note that solution (2) still works as-is even if the version gets upgraded by #593 . You can see the option is the same in the latest Piscina version here I can confirm locally that if I make this change, pgtyped codegen work with Deno 2👍 Other changes required at runtimeWhen it comes to actually using the code that was generated, there is another issue you need to fix:
|
Pgtyped + Deno in theory sounds like a great match but I do wonder how easy it is to make this lib compatible with Deno runtime.
Luckily, the most developed deno pg client so far is based on the most used node pg client. https://deno-postgres.com
The text was updated successfully, but these errors were encountered: