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

nodejs postgresql driver #92

Open
axelhuizinga opened this issue Feb 19, 2020 · 1 comment
Open

nodejs postgresql driver #92

axelhuizinga opened this issue Feb 19, 2020 · 1 comment

Comments

@axelhuizinga
Copy link

I would like to use your lib but need a nodejs pg driver - can we add the missing pieces quickly?

@piboistudios
Copy link

piboistudios commented Feb 21, 2020

Well, I am similarly planning to write a Driver for node mssql.

Maybe this will help but my plan so far is:

  • write a formatter like format.MySqlFormatter, not a huge postgre guy, but if it's as different from MySql as MSSQL is, this is where most of your work is. Main thing is overriding the methods for SQL-tink/Haxe type conversions
  • write a class like drivers.MySql for SQL server (mostly just write a fallback sanitizer here), also stick your driver impl for node Pg here after the next step is done
  • write a driver like drivers.node.MySql (this is where you'll set up your extern for whatever postgre package you use, probably postgre, I don't think you can use it's sanitizer since it works with tagged literals, hence fallback sanitizer you've written by now) and then use that to mirror the behavior you see in drivers.MySql.

The main thing I have yet to figure out is how to deal with a more promise based API.. both PG and MSSQL return connection pools as promises in the packages I've seen and MySQL doesn't apparently. But I'm sure that's not a big deal since tink already natively support JS promises.

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

No branches or pull requests

2 participants