// Open a connection and stream from the database pool .connect() .pipe( concatMap((poolClient) => { const { poolClient } = val;
poolClient .stream(sql`SELECT * FROM get_animals()`) // Use finalize to release the pool connection after all rows are returned .pipe(finalize(() =>poolClient.release().subscribe())) }) ) .subscribe({ next: (val) => { // Emits individual rows }, complete: () => { // Complete is called when all rows have been read } });
The RxJS wrapper for
pg.Pool
.Example
Example
Example
Example
Public Api