pg-ts-v2
v1.0.1
Published
Typescript wrapper around node-postgres
Readme
pg-ts
Typescript wrapper around node-postgres
:boom: breaking change :rocket: new feature :bug: bug fix :wrench: chore :notebook: docs
v10.0.0
- :boom: Move to fp-ts version 2
v9.0.3
- :wrench: improve PgDriverQueryError message
v9.0.2
- :bug: If a
queryOneOrNonewas executed with SQL that selected insufficient columns to fully populate the row type, it would erroneously returnNone. Fixed now to return the expectedPgRowValidationErrortype.
v9.0.1
- :bug: Prevent array positional parameters from being deduped.
v9.0.0
- :boom: An additional
contextparam has been added toconnection.queryandqueryXfunctions. This is a blob of data that will be attached to query and transaction error instances. The normal use case for this is attaching application context so that error reporting functions can group errors together, or log out additional information about where the error came from.
v8.1.0
- :rocket: Add
namedfunction to set the name of a givenSQL-templated query.
v8.0.1
- :bug: Sql fragment parser should unwrap complex types (e.g. NonEmptyArray, Option) before passing it to the driver.
v8.0.0
- :bug: Fix broken nominal typing on classes by changing
public readonly _T = "<class name>"topublic readonly _<class name>: void. - :boom: As a result of fixing nominal typing,
makeConnectionPoolnow returns an error union ofPgPoolCreationError | PgTypeParserSetupErrorinstead ofPgPoolCreationError. Other errors may occur in application code as a result of the error classes now being correctly differentiated.
v7.0.0
- :boom:
[email protected] - :boom:
[email protected] - :boom:
[email protected]
v6.0.1
- :wrench: Add _T symbol to uniquely identify error classes
v6.0.0
- :boom: Simplified the API by always requiring an environment object in which pg-ts can
store it's state (
Connection) under aSymbolkey. This will never conflict with other keys in theE, so we can now removeConnectionEand related subsequent design decisions.
v5.0.1
- :bug:
QueryAnyErrorunion includedPgRowCountError. This is incorrect (obvs). - :wrench: Compiled with TS3.0.1.
v5.0.0
Eitherish functions no longer return a simpleErrortype in theirLefts. 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 providedErrorPredicatefunctions, e.g,isRowCountError. Application-defined error types are propagated through thepg-tsstack.Commonly-grouped errors are provided as unions, e.g.
ConnectionError<L>,TransactionError<L>.Renamed
withConnectionEtowidenToConnectionEfor clarity and to differentiate from thewithConnectionEfunction defined onConnection.withTransactionhas 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
typessetting in package.json, so imports should now default tofrom "pg-ts"instead offrom "pg-ts/dist".Integration tests are provided. A
DATABASE_URLenvironment 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.
