{"id":18595022,"url":"https://github.com/eugabrielsilva/rapidsql","last_synced_at":"2026-05-08T03:42:12.326Z","repository":{"id":57112189,"uuid":"296211150","full_name":"eugabrielsilva/rapidSQL","owner":"eugabrielsilva","description":"A very simple and easy to use promise-based MySQL wrapper for Node.js","archived":false,"fork":false,"pushed_at":"2022-10-07T11:20:23.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T12:14:32.333Z","etag":null,"topics":["database-wrapper","mysql","nodejs"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@eugabrielsilva/rapidsql","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/eugabrielsilva.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-09-17T03:39:53.000Z","updated_at":"2021-11-24T17:02:05.000Z","dependencies_parsed_at":"2022-08-21T10:31:09.148Z","dependency_job_id":null,"html_url":"https://github.com/eugabrielsilva/rapidSQL","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugabrielsilva%2FrapidSQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugabrielsilva%2FrapidSQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugabrielsilva%2FrapidSQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugabrielsilva%2FrapidSQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eugabrielsilva","download_url":"https://codeload.github.com/eugabrielsilva/rapidSQL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527096,"owners_count":22085919,"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":["database-wrapper","mysql","nodejs"],"created_at":"2024-11-07T01:18:04.963Z","updated_at":"2025-10-26T23:35:19.188Z","avatar_url":"https://github.com/eugabrielsilva.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rapidSQL\nA very simple and easy to use promise-based MySQL wrapper for Node.js.\n\n### Installation\n```\nnpm install @eugabrielsilva/rapidsql\n```\n\n### Setting up\n```js\nconst rapidSQL = require('@eugabrielsilva/rapidsql');\nconst db = new rapidSQL({host: DB_HOST, user: DB_USER, password: DB_PASSWORD, database: DB_DATABASE});\n```\n\nProvide the connection options as an object in the database constructor. Valid options are:\n\n- `host` (optional): The hostname of the database you are connecting to. (Defaults to `localhost`)\n- `user` (optional): The MySQL user to authenticate as. (Defaults to `root`)\n- `password` (optional): The password of that MySQL user. (Defaults to empty)\n- `database` **(required)**: Name of the database to use for this connection.\n- `port` (optional): The port number to connect to. (Defaults to `3306`)\n- `connectionLimit` (optional): The maximum number of connections to create at once. (Defaults to `10`)\n- `stringifyObjects` (optional): Stringify objects instead of converting to values. (Defaults to `false`)\n- `debug` (optional): Prints protocol details to `STDOUT`. (Defaults to `false`)\n\n### Connecting to the database\nThis library uses connection pools as default. You only need to connect to the database once. The connection is made asynchronously.\n\n```js\ndb.connect().then(() =\u003e {\n    console.log('Successfully connected!');\n}).catch((err) =\u003e {\n    console.log(err);\n});\n```\n\n### Running SQL queries\nYou can run SQL queries by using the `sql()` method. All queries are made asynchronously and will respond with a result object or an array of objects.\n\n```js\ndb.sql('SELECT * FROM table_name').then((result) =\u003e {\n    console.log(result);\n}).catch((err) =\u003e {\n    console.log(err);\n});\n```\n\n#### Escaping query values\nIn order to avoid SQL Injection attacks, you should always escape any user provided data before using it inside a SQL query. You can do this by using `?` characters as placeholders for values you would like to have escaped like this:\n\n```js\nlet userID = 5;\ndb.sql('SELECT * FROM users WHERE ID = ?', [userID]).then((result) =\u003e {\n    console.log(result);\n}).catch((err) =\u003e {\n    console.log(err);\n});\n```\n\nMultiple placeholders are mapped to values in the same order as passed. For example, in the following query `foo` equals `a`, `bar` equals `b`, `baz` equals `c`, and `ID` will be `userID`:\n\n```js\nlet userID = 5;\ndb.sql('UPDATE users SET foo = ?, bar = ?, baz = ? WHERE ID = ?', ['a', 'b', 'c', userID]).then((result) =\u003e {\n    console.log(result);\n}).catch((err) =\u003e {\n    console.log(err);\n});\n```\n\n### Closing the connection\nIf you are not going to use the connection anymore, you can close it by using the `close()` method. This method will wait until all pending queries are executed.\n\n```js\ndb.close().then(() =\u003e {\n    console.log('Successfully disconnected!');\n}).catch((err) =\u003e {\n    console.log(err);\n});\n```\n\n### Credits\nLibrary developed and currently maintained by [Gabriel Silva](https://github.com/eugabrielsilva).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugabrielsilva%2Frapidsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feugabrielsilva%2Frapidsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugabrielsilva%2Frapidsql/lists"}