denodrivers / postgres

PostgreSQL driver for Deno

Home Page:https://denodrivers.github.io/postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.0 API discussion

Soremwar opened this issue · comments

  • Use static async initializers instead of constructors + ready states

queryArray/queryObject

  • Remove query*(sql, ...params) overload. Parameters must be provided as an object or as an array instead of relying on rest syntax
  • QueryConfig.args -> arguments
  • QueryConfig.text -> query
  • Remove QueryConfig.encoder

Client derivates

  • applicationName -> application_name
  • hostname -> host (Add JSDoc indicating this can be a path to a Unix socket as well)
  • tls.caCertificates -> ca_certificates
  • tls.enable and tls.enforce must be merged into a single option

Pool

  • Pool can be initialized without arguments, just like Client
  • Pool options should be passed as an object, instead of additional arguments
  • Pool size should have a default
  • connect -> getClient

QueryResult

  • rowCount -> affectedRows
  • affectedRows is always set
  • command must be a union type, not string
  • text -> query
commented
  • rowCount -> affectedRows +1
  • affectedRows is always set +1

More pool options like the node pg package has would be nice. You might be able to re-use code from pg-pool. The pg package uses the pg-pool package for managing it's pools and has options related to timing out connections and recreating them if they have been connected for a long time.

https://www.npmjs.com/package/pg-pool