postgres icon indicating copy to clipboard operation
postgres copied to clipboard

1.0 API discussion

Open Soremwar opened this issue 3 years ago • 2 comments
trafficstars

API v1.0

  • [ ] Use static async initializers instead of constructors + ready states
  • [ ] #446
  • [x] #239
  • [x] #450

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

Pooling

  • [ ] 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

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

QueryResult

  • [ ] rowCount -> affectedRows
  • [ ] affectedRows is always set
  • [ ] command must be a union type, not string
  • [ ] text -> query

Edited for brevity and clarity

Soremwar avatar Jan 07 '22 15:01 Soremwar

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

Soremwar avatar Jan 07 '22 15:01 Soremwar

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

Soremwar avatar Jan 07 '22 15:01 Soremwar

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

Soremwar avatar Jan 07 '22 18:01 Soremwar

QueryResult

  • [ ] rowCount -> affectedRows
  • [ ] affectedRows is always set
  • [ ] command must be a union type, not string
  • [ ] text -> query

Soremwar avatar Jan 14 '22 18:01 Soremwar

  • rowCount -> affectedRows +1
  • affectedRows is always set +1

iugo avatar Mar 19 '22 12:03 iugo

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

KyleJune avatar May 20 '22 13:05 KyleJune