{"id":32400768,"url":"https://github.com/blusewang/postgre-sql","last_synced_at":"2025-10-25T09:45:57.064Z","repository":{"id":57328741,"uuid":"95520108","full_name":"blusewang/postgre-sql","owner":"blusewang","description":"A PostgreSQL support for node.js, based on node-postgres and used Pool.","archived":false,"fork":false,"pushed_at":"2018-03-13T18:01:33.000Z","size":23,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-12T07:23:04.269Z","etag":null,"topics":["builder","pg","pool","sql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blusewang.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":"2017-06-27T05:16:58.000Z","updated_at":"2018-03-13T18:01:34.000Z","dependencies_parsed_at":"2022-09-05T12:51:29.827Z","dependency_job_id":null,"html_url":"https://github.com/blusewang/postgre-sql","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/blusewang/postgre-sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blusewang%2Fpostgre-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blusewang%2Fpostgre-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blusewang%2Fpostgre-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blusewang%2Fpostgre-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blusewang","download_url":"https://codeload.github.com/blusewang/postgre-sql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blusewang%2Fpostgre-sql/sbom","scorecard":{"id":245112,"data":{"date":"2025-08-11","repo":{"name":"github.com/blusewang/postgre-sql","commit":"37bbdebdd278cd69024328df486d81c45bf8ce30"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T07:26:45.818Z","repository_id":57328741,"created_at":"2025-08-17T07:26:45.818Z","updated_at":"2025-08-17T07:26:45.818Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280936415,"owners_count":26416543,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["builder","pg","pool","sql"],"created_at":"2025-10-25T09:45:53.223Z","updated_at":"2025-10-25T09:45:57.059Z","avatar_url":"https://github.com/blusewang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/1764005/27760456-3dffad94-5e7a-11e7-875a-095b8a0dfd57.png\"/\u003e\u003c/p\u003e\n\n# postgre-SQL\nA PostgreSQL support for node.js, based on node-postgres and used Pool.\n\n\n## 安装\n`npm i postgre-sql`\n## 配置\n```js\nconst {connect} = require('postgre-sql');\nconnect({user:'postgres',database:'test',max:2,idleTimeoutMillis:100});\n\n```\n\n## 使用DEMO\n```js\nconst {client} = require('postgre-sql');\nlet db = new client();\n(async ()=\u003e{\n    try{\n        let res = await db.table('public.users')\n            .where({vip:true},\"create_at\u003e'2017-01-01' and coordinate \u003c-\u003e point(116,39) \u003c 1\")\n            .field('uid,user_name').order('uid desc').page(2).select();\n            // res -\u003e [{uid:34,use_name:'alice'},{uid:35,user_name:'💘'}...]\n    }catch (e){\n        // something else\n    }\n    try{\n        await db.begin();\n        let new_uid = await db.table('public.users').add({user_name:'charles'});\n        await db.commit();\n    }catch (e){\n        db.rollback();\n    }\n    \n})();\n\n```\n\n## 会话模式\n\n默认是`statement`模式，这个模式的语句会平均负载到池中所有的连接。适合并行查询！\n\n会话模式会根据业务自动调整。\n\n### 语句模式 `statement`\n```js\nconst {client} = require('postgre-sql');\nlet db = new client();\n(async ()=\u003e{\n    try{\n        let res = await db.table('public.users')\n            .where({vip:true},\"create_at\u003e'2017-01-01' and coordinate \u003c-\u003e point(116,39) \u003c 1\")\n            .field('uid,user_name').order('uid desc').page(2).select();\n            // res -\u003e [{uid:34,use_name:'alice'},{uid:35,user_name:'💘'}...]\n    }catch (e){\n        // something else\n    }\n})();\n```\n\n### 会话模式 `session`\n\n```js\nconst {client} = require('postgre-sql');\nlet db = new client();\n(async ()=\u003e{\n    try{\n        await db.connect();\n        let res = await db.table('public.users')\n            .where({vip:true},\"create_at\u003e'2017-01-01' and coordinate \u003c-\u003e point(116,39) \u003c 1\")\n            .field('uid,user_name').order('uid desc').page(2).select();\n            // res -\u003e [{uid:34,use_name:'alice'},{uid:35,user_name:'💘'}...]\n        await db.release(); // Attention! if connection a session don't forget release it!\n    }catch (e){\n        await db.release(); // Attention! if connection a session don't forget release it!\n        // something else\n    }\n})();\n```\n\n### 事务模式 `transaction`\n\n```js\nconst {client} = require('postgre-sql');\nlet db = new client();\n(async ()=\u003e{\n    try{\n        await db.begin();\n        let new_uid = await db.table('public.users').add({user_name:'charles'});\n        await db.commit(); // Attention! if start a transaction don't forget finish it!\n    }catch (e){\n        db.rollback(); // Attention! if start a transaction don't forget finish it!\n    }\n    \n})();\n```\n\n## 自动完成\n\n如果表中有`create_at`、`update_at`、`delete_at`。在CUD的操作中会自动填充`NOW()`。\n\n软删除只在`db.table(tableName).where(conditions).delete();`时影响结果。\n\n在`SELECT`类型的语句中，不会主动识，别并剔除`delete_at`非空的记录。需要手动写在`conditions`中。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblusewang%2Fpostgre-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblusewang%2Fpostgre-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblusewang%2Fpostgre-sql/lists"}