Typescript wrapper around node-postgres
π₯ breaking change π new feature π bug fix π§ chore π docs
## v7.0.0
- π₯
[email protected]
- π₯
[email protected]
- π₯
[email protected]
- π§ add _T symbol to uniquely identify error classes
- π₯ Simplified the API by always requiring an environment object in which pg-ts can
store it's state (
Connection
) under aSymbol
key. This will never conflict with other keys in theE
, so we can now removeConnectionE
and related subsequent design decisions.
- π
QueryAnyError
union includedPgRowCountError
. This is incorrect (obvs). - π§ Compiled with TS3.0.1.
-
Either
ish functions no longer return a simpleError
type in theirLeft
s. Instead, we now provide a union of concrete error types that make it explicit what the failure conditions are. Clients can pattern match on error type using the providedErrorPredicate
functions, e.g,isRowCountError
. Application-defined error types are propagated through thepg-ts
stack. -
Commonly-grouped errors are provided as unions, e.g.
ConnectionError<L>
,TransactionError<L>
. -
Renamed
withConnectionE
towidenToConnectionE
for clarity and to differentiate from thewithConnectionE
function defined onConnection
. -
withTransaction
has been replaced by three similar functions that assist you depending on whether you want to go from:Outer Context Inner Context Function to use Connection
Connection
withTransactionC
ConnectionE<E>
ConnectionE<E>
withTransactionE
ConnectionE<E>
Connection
withTransactionEC
-
Fixed the
types
setting in package.json, so imports should now default tofrom "pg-ts"
instead offrom "pg-ts/dist"
. -
Integration tests are provided. A
DATABASE_URL
environment variable must be present. The test suite will create the table it needs and will truncate before each test. Every query type is tested and transaction commit/rollback behaviour is also verified.