{"id":20135507,"url":"https://github.com/skuyjs/query-builder","last_synced_at":"2026-05-06T00:07:08.828Z","repository":{"id":41680489,"uuid":"252876034","full_name":"skuyjs/query-builder","owner":"skuyjs","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-06T16:37:15.000Z","size":305,"stargazers_count":2,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T22:41:35.787Z","etag":null,"topics":["hacktoberfest","mariadb","mysql2","postgresql","query-builder"],"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/skuyjs.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":"2020-04-04T00:50:05.000Z","updated_at":"2020-12-15T14:57:44.000Z","dependencies_parsed_at":"2023-01-23T11:15:49.510Z","dependency_job_id":null,"html_url":"https://github.com/skuyjs/query-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skuyjs/query-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skuyjs%2Fquery-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skuyjs%2Fquery-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skuyjs%2Fquery-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skuyjs%2Fquery-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skuyjs","download_url":"https://codeload.github.com/skuyjs/query-builder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skuyjs%2Fquery-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32672688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hacktoberfest","mariadb","mysql2","postgresql","query-builder"],"created_at":"2024-11-13T21:15:14.772Z","updated_at":"2026-05-06T00:07:08.814Z","avatar_url":"https://github.com/skuyjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @skuyjs/query-builder\nSQL query builder for NodeJS\n\n## Compatibility\nThis query builder is compatible with following Database Management Systems.\n- MySQL via [mysql](https://www.npmjs.com/package/mysql)/[mysql2](https://www.npmjs.com/package/mysql2)\n- MariaDB via [mariadb](https://www.npmjs.com/package/mariadb)\n- PostgreSQL via [pg](https://www.npmjs.com/package/pg)\n\n## Installation\nYou can install by run this command inside your project by using terminal.\n```bash\nnpm i @skuyjs/query-builder\n```\n\n## Usage\n### Connecting to database server\nType this following lines in your `.js` file and you can run it.\n```javascript\nconst Database = require('@skuyjs/query-builder');\nconst db = new Database({\n  dialect: 'mysql',\n  username: 'root',\n  password: 'root',\n  database: 'test',\n});\n\nconsole.log(db.getDialect());\n```\nIt will give you `mysql` (your dialect) as output.\n\n\u003e As dialect you choose, it have to installed first.\n\u003e\n\u003e Example:\n\u003e  - `npm install mysql` for mysql\n\u003e  - `npm install mysql2` for mysql2\n\u003e  - `npm install mariadb` for mariadb\n\u003e  - `npm install pg` for pg\n\n### Querying\n#### Select\nGetting all data (select query) can do by use following lines.\n```javascript\n...\ndb\n  .table('users')\n  .all()\n  .then(console.log)\n  .catch(console.log);\n\n// prints all data in users table\n```\n\nGetting all data with specific column(s), see following example.\n```javascript\n...\ndb\n  .table('users')\n  .get('fullname', 'email', 'password')\n  .then(console.log)\n  .catch(console.log);\n\n// prints all data in users table, but\n// only fullname, email, and password columns\n```\n\n#### Insert\nInserting a data can do by use following lines.\n```javascript\n...\ndb\n  .table('users')\n  .insert([null, 'my fullname', 'example@email.top', 'mypass123'])\n  .then(console.log)\n  .catch(console.log);\n\n// inserting data into users table\n// prints insertion result\n```\n\nInserting a data with specific column(s) can do by use following lines.\n```javascript\n...\ndb\n  .table('users')\n  .insert({\n    fullname: 'my fullname',\n    email: 'example@email.top',\n    password: 'mypass123'\n  })\n  .then(console.log)\n  .catch(console.log);\n\n// inserting data into users table\n// prints insertion result\n```\n\n#### Update\nUpdating all data(s) can do by use following lines.\n```javascript\ndb\n  .table('users')\n  .update({ fullname: 'aye' })\n  .then(console.log)\n  .catch(console.log);\n\n// updating all data in users table\n// prints update result\n```\n\nUpdating data(s) with specific row(s) can do by use following lines.\n```javascript\ndb\n  .table('users')\n  .where({ id: 1 })\n  .update({ fullname: 'aye' })\n  .then(console.log)\n  .catch(console.log);\n\n// updating data(s) with 1 as id in users table\n// prints update result\n```\n\n#### Delete\nDeleting all datas can do by use following lines.\n```javascript\ndb\n  .table('users')\n  .del()\n  .then(console.log)\n  .catch(console.log);\n\n// deleting all data in users table\n// prints deletion result\n```\n\nDeleting data(s) with specific row(s) can do by use following lines.\n```javascript\ndb\n  .table('users')\n  .where({ id: 1 })\n  .del()\n  .then(console.log)\n  .catch(console.log);\n\n// deleting data(s) with 1 as id in users table\n// prints deletion result\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskuyjs%2Fquery-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskuyjs%2Fquery-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskuyjs%2Fquery-builder/lists"}