{"id":19572935,"url":"https://github.com/erickwendel/nodered-knex-connection","last_synced_at":"2025-04-27T05:32:04.358Z","repository":{"id":248185821,"uuid":"828006245","full_name":"ErickWendel/nodered-knex-connection","owner":"ErickWendel","description":"Create Knex connections securely and at easy ","archived":false,"fork":false,"pushed_at":"2024-07-13T21:02:29.000Z","size":90,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-13T23:41:53.523Z","etag":null,"topics":["javascript","knex","nodejs","nodered","pg"],"latest_commit_sha":null,"homepage":"https://flows.nodered.org/node/@erickwendel/nodered-knex-connection","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ErickWendel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-12T21:42:45.000Z","updated_at":"2024-07-13T21:02:32.000Z","dependencies_parsed_at":"2024-07-12T23:52:12.725Z","dependency_job_id":null,"html_url":"https://github.com/ErickWendel/nodered-knex-connection","commit_stats":null,"previous_names":["erickwendel/nodered-knex-connection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErickWendel%2Fnodered-knex-connection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErickWendel%2Fnodered-knex-connection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErickWendel%2Fnodered-knex-connection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ErickWendel%2Fnodered-knex-connection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ErickWendel","download_url":"https://codeload.github.com/ErickWendel/nodered-knex-connection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224060427,"owners_count":17249022,"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","knex","nodejs","nodered","pg"],"created_at":"2024-11-11T06:31:00.533Z","updated_at":"2024-11-11T06:31:21.990Z","avatar_url":"https://github.com/ErickWendel.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Knex Nodered Connection\n\nThis Node-RED custom node provides a Knex instance for DB connections. (currently only working with Postgres)\n\n## Configuration\n\n- **URI**: The connection string for the PostgreSQL database.\n- **SSL**: Whether to use SSL for the connection.\n- **Timezone**: The timezone to set for the connection.\n- **Pool Log**: Whether to log pool events.\n- **Pool Min**: Minimum number of connections in the pool.\n- **Pool Max**: Maximum number of connections in the pool.\n- **Acquire Timeout Millis**: The time in milliseconds to wait for a connection to be acquired.\n- **Create Timeout Millis**: The time in milliseconds to wait for a connection to be created.\n- **Idle Timeout Millis**: The time in milliseconds to wait before an idle connection is released.\n\n## Example\n\nYou an checkout the examples in [./examples](https://github.com/ErickWendel/nodered-knex-connection/blob/main/examples/)\n\n![Node-RED flow](https://github.com/ErickWendel/nodered-knex-connection/blob/main/example.png?raw=true)\n\n```json\n[{\"id\":\"df81e2e5ef4d4071\",\"type\":\"inject\",\"z\":\"5e284026436c6b42\",\"name\":\"\",\"props\":[{\"p\":\"payload\"},{\"p\":\"topic\",\"vt\":\"str\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":320,\"y\":100,\"wires\":[[\"6d8ffd6bbb02d8cf\"]]},{\"id\":\"1b23eda5384dcd27\",\"type\":\"debug\",\"z\":\"5e284026436c6b42\",\"name\":\"show output\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"payload\",\"targetType\":\"msg\",\"statusVal\":\"\",\"statusType\":\"auto\",\"x\":870,\"y\":100,\"wires\":[]},{\"id\":\"164a1ef82b99eabb\",\"type\":\"function\",\"z\":\"5e284026436c6b42\",\"name\":\"select 1 from db\",\"func\":\"const knex = msg.knex\\nconst result = await knex.raw(`\\n            SELECT 1 as result;\\n        `);\\n\\nmsg.payload = result.rows[0].result; \\n\\nreturn msg;\",\"outputs\":1,\"timeout\":0,\"noerr\":0,\"initialize\":\"\",\"finalize\":\"\",\"libs\":[],\"x\":680,\"y\":100,\"wires\":[[\"1b23eda5384dcd27\"]]},{\"id\":\"6d8ffd6bbb02d8cf\",\"type\":\"knex-node\",\"z\":\"5e284026436c6b42\",\"uri\":\"${POSTGRES_URI}\",\"searchPath\":\"[\\\"public\\\"]\",\"ssl\":false,\"timezone\":\"${TZ}\",\"poolMin\":\"1\",\"poolMax\":10,\"acquireTimeoutMillis\":30000,\"createTimeoutMillis\":30000,\"idleTimeoutMillis\":1000,\"additionalKnexConf\":\"{}\",\"x\":490,\"y\":100,\"wires\":[[\"164a1ef82b99eabb\"]]}]\n```\n## Features\n    - Reuses DB connections across nodes/flows\n    - Terminate connections when they're not needed anymore\n    - In case of deploying specific nodes, it doesn't change the running ones\n    - Update node status every 200ms checking if the DB Connection is still valid\n\n# Dependencies\n\nIt uses knex on 3.1.0 and pg on 8.12.0","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferickwendel%2Fnodered-knex-connection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferickwendel%2Fnodered-knex-connection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferickwendel%2Fnodered-knex-connection/lists"}