tink_sql icon indicating copy to clipboard operation
tink_sql copied to clipboard

nodejs postgresql driver

Open axelhuizinga opened this issue 4 years ago • 1 comments

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

axelhuizinga avatar Feb 19 '20 17:02 axelhuizinga

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.

piboistudios avatar Feb 21 '20 12:02 piboistudios