{"id":23315446,"url":"https://github.com/ihoro/rough-rx-pg","last_synced_at":"2025-07-10T12:43:58.860Z","repository":{"id":48311149,"uuid":"166314294","full_name":"ihoro/rough-rx-pg","owner":"ihoro","description":"Rough implementation of rxified wrapper of node-postgres lib","archived":false,"fork":false,"pushed_at":"2021-08-02T08:36:58.000Z","size":6,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-16T21:35:34.986Z","etag":null,"topics":["javascript","nodejs","postgres","reactive-extensions","rxjs","sql","wrapper"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ihoro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-17T23:55:09.000Z","updated_at":"2023-02-02T15:22:12.000Z","dependencies_parsed_at":"2022-09-21T10:50:18.256Z","dependency_job_id":null,"html_url":"https://github.com/ihoro/rough-rx-pg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihoro%2Frough-rx-pg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihoro%2Frough-rx-pg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihoro%2Frough-rx-pg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihoro%2Frough-rx-pg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ihoro","download_url":"https://codeload.github.com/ihoro/rough-rx-pg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230606112,"owners_count":18252386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","postgres","reactive-extensions","rxjs","sql","wrapper"],"created_at":"2024-12-20T15:37:35.874Z","updated_at":"2024-12-20T15:37:36.542Z","avatar_url":"https://github.com/ihoro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rx'ified node-postgres (pg)\n\n[![Build Status](https://travis-ci.com/ihoro/rough-rx-pg.svg?branch=master)](https://travis-ci.com/ihoro/rough-rx-pg)\n[![npm version](https://badge.fury.io/js/%40rough%2Frx-pg.svg)](https://badge.fury.io/js/%40rough%2Frx-pg)\n\nRough implementation of [rxified](https://npmjs.com/rxjs) wrapper of [node-postgres](https://npmjs.com/pg) lib.\n\n## Getting started\n\nInstallation\n```\n$ npm i pg @rough/rx-pg\n```\n\nA simple query\n```js\nconst { finalize } = require('rxjs/operators');\nconst { Pool } = require('pg');\nconst RxPg = require('@rough/rx-pg');\n\nconst pool = new Pool({\n  host: 'localhost',\n  user: 'root',\n  password: 'root',\n  database: 'myproject',\n  max: 50,\n  idleTimeoutMillis: 30000,\n  connectionTimeoutMillis: 2000\n});\n\nconst rxpg = new RxPg(pool);\n\nrxpg\n  .query('select * from users')\n  .pipe(finalize(_ =\u003e pool.end()))\n  .subscribe(result =\u003e console.log(result));\n```\n\nA simple transaction\n```js\nrxpg\n  .transaction(\n    (rxpg, prevResult) =\u003e rxpg.query('select * from users where id = ? for update', 42),\n    (rxpg, prevResult) =\u003e rxpg.query('delete from deals where user_scope_id = ?', prevResult[0].user_scope_id),\n    (rxpg, prevResult) =\u003e rxpg.query('delete from inventory where user_id = ?', 42),\n  )\n  .pipe(finalize(_ =\u003e pool.end()))\n  .subscribe(result =\u003e console.log(result));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihoro%2Frough-rx-pg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fihoro%2Frough-rx-pg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihoro%2Frough-rx-pg/lists"}