question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discussion: Deno Port

See original GitHub issue

I have been having a close look at deno and have had an attempt to build a solution with it. It is delightfully refreshing to not have to build a project, and to be able to use the current JavaScript language features.

At this point in time, there are limited options for working with PostgreSQL.

The main project on the Third Party Modules list, deno-postgres, has one major feature missing and one show stopper bug. I considered trying to contribute to the project however after having a look at what has been done with this project, there are huge amounts of work required.

I looked for an issue being raised here about porting over to Deno and there was none so I’m bringing up the discussion.

I am no expert on Deno although I did migrate a couple of projects over to it already being pg-format and cuid.

As far as I am aware, to migrate this project so that it will work on Deno would require the following:

I imagine the mix of js and ts modules would be an issue. I’m not a TypeScript guy. There are probably a few other issues which will arise as you would expect.

The deno-postgres project has been created by one of the main Deno developers, Bartek Iwańczuk, and he has stated that he is busy with the core of Deno at the moment. He is going to work on it soon. It is not a fork of this project though and is missing many features at this time.

When you consider the vast amount of work that has been put into this project, it seems a shame to re-invent the wheel. Both Node.js and Deno run JavaScript. That being said, Deno tries as much as possible to stick to the Web Standard APIs. This will mean significant changes and therefore it is unlikely to be able to keep the Node.js and Deno port in sync.

I’m just opening the discussion here to gauge interest.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
brianccommented, May 22, 2020

I’m totally cool with any kind of port or fork you think is good to get postgres support more built out on Deno. This part of the library in particular should be useful as its written in TypeScript already and doesn’t have many 3rd party dependencies. If there’s a way to remove all the node dependencies and make it portable to Deno while maintaining the same performance characteristics I’d be open to discussing merging that here & have re-use across platforms.

That being said, my primary focus for the rest of 2020 is to continue to improve perf on this library, modernize it (some of the code is >10 years old!) and provide an extremely robust and well tested platform for node.js postgres connections. I’m happy to help out in a limited capacity with Deno support, but I think its best for the community if I continue to focus on primarily supporting node.js. I’ve been involved in the node community for >10 years now, and I watched trends come and go. If Deno becomes huge and replaces node, that’ll be interesting, but even then I will still focus on support this library and the millions of installations it has throughout the world. That’s my primary focus, and I don’t have any plans to refocus in the foreseeable future. If I check the weekly installs and it drops below a few thousand I’ll probably retire from open source at that point…but as far as I can see that’s years from now. 😄

Who knows! Anything could happen & I’m happy to help out anywhere I can so long as it doesn’t detract from my focus on this lib! Also, this code is all open source so feel free to base any implementation on it. All I ask, for the community’s sake, is that you take the time to PR any bug fixes you find in any ports back here…I’ve sunk literally thousands of hours into this project over the years (mostly GH issue triage, bug research, etc) and would be happy to merge any improvements that “life all boats” like rising tides are wont to do.

@malthe would you be interested in trying pg-protocol in your own library actually?..it’s very, very battle tested protocol parser for postgres supporting every message type defined & totally written in TypeScript! Might be a good move to pool our efforts rather than write different protocol parsers. An example would be you find a perf improvement in parsing, you put it into pg-protocol and it impacts your lib and the millions of installs of node-postgres at the same time! 👯 Happy to make you a collaborator on this repo after a couple PRs w/ fixes.

I know ts-postgres does some different things wrt batching & stuff I’m going to work on here in the nearish future, but an entire from the ground rewrite of parsing in your module is probably redundant if you want to use pg-protocol. Either way…cool project!

Perhaps in the future we can consolidate our efforts and improve things for node & postgres as a whole in this project instead of fragmenting the module landscape…though I’m well aware that’s the open source way and a the node community has always trended really hard that way. 🤷

0reactions
malthecommented, May 24, 2020

@brianc pg-protocol looks good; if I can get around to it, I’ll try and see if it’ll fit easily into the codebase – because you’re absolutely right, it would be great to consolidate around a single implementation for the protocol. When I wrote the code I don’t think there was such a package available, at least not written in TypeScript.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP PDO MySQL Class port to Deno? #9229 - GitHub
I'm a PHP developer and since PHP is open source I was wondering if you could port PDO to Deno. This would greatly...
Read more >
HTTP web server | Manual - Deno
To have the APIs discussed here available, you must run Deno with the --unstable ... Start listening on port 8080 of localhost. const...
Read more >
Dr. Yohanna Deno, MD | Stuart, FL | Internist | US News Doctors
Dr. Yohanna Deno is a Internist in Stuart, FL. Find Dr. Deno's address, hospital affiliations and more.
Read more >
Guide To Porting Node Modules To Deno - DEV Community ‍ ‍
Tagged with deno, node, typescript, javascript. ... easily be Denoified you will need to write a partial Deno port of the bits your...
Read more >
An Introduction to Deno: Is It Better than Node.js?
In this article, we'll discuss why Deno was created and its advantages ... (stdlib) that aims to be a loose port of Go's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found