{"id":16546945,"url":"https://github.com/calemy/mysql-commands","last_synced_at":"2025-06-14T04:06:03.098Z","repository":{"id":61425446,"uuid":"547892516","full_name":"Calemy/mysql-commands","owner":"Calemy","description":"a promised based mysql wrapper in nodejs","archived":false,"fork":false,"pushed_at":"2023-04-21T13:37:19.000Z","size":32,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T04:04:05.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Calemy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-08T14:02:43.000Z","updated_at":"2023-06-12T21:26:15.000Z","dependencies_parsed_at":"2025-02-13T14:44:54.236Z","dependency_job_id":null,"html_url":"https://github.com/Calemy/mysql-commands","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Calemy/mysql-commands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calemy%2Fmysql-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calemy%2Fmysql-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calemy%2Fmysql-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calemy%2Fmysql-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Calemy","download_url":"https://codeload.github.com/Calemy/mysql-commands/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calemy%2Fmysql-commands/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259756874,"owners_count":22906678,"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":[],"created_at":"2024-10-11T19:13:09.744Z","updated_at":"2025-06-14T04:06:02.857Z","avatar_url":"https://github.com/Calemy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mysql-commands\na promised based mysql wrapper in nodejs!\n\u003cbr\u003e\nsome updates still expected\n\n## How to use it\n\n#### Create the wrapper\n\n```js\nconst mysql = require('mysql-commands')\n\nconst database = mysql.createConnection({\n    host: host,\n    user: username,\n    password: password,\n    database: db\n})\n```\n\n#### Select\n\nYou can select single or multiple records from the database with ease!\n\n```js\n\n/* \n    Optional\n    values: the values you want to recieve - default: *\n    condition: what condition has to be applied to return the result\n    sort: what you want to sort by\n    limit: how many rows to return - default: Infinite (only available on multi search)\n    offset: offset result by x amount - default: 0 (only available on multi search)\n*/\n\nconst values = [\"id\", \"username\"]\nconst condition = \"id = 1\"\nconst sort = [\"id DESC\"]\n\n//Search for multiple records, sort by id decreasing and limit results to 50\nconst users = await database.select(\"users\", { values, sort, limit: 50 })\n\n//Search for single record\nconst user = await database.selectOne(\"users\", { values, condition })\n```\n\n#### Insert\n\nYou can also insert records with pretty much no effort!\n\u003cbr\u003e\nThere is also an updateOnDuplicate option that can be selected.\n\n```js\nlet user = {\n    id: 1,\n    username: \"Nanoo\",\n    rank: \"Admin\"\n}\n\nawait database.insert(\"users\", { object: user })\n\n//Update on duplicate\n\nuser.username = \"Lemres\"\n\nawait database.insert(\"users\", { object: user, updateOnDuplicate: true})\n```\n\n#### Update\n\nEven updating does not require a lot of work!\n\n```js\n\nlet user = {\n    id: 1,\n    username: \"Nanoo\",\n    rank: \"Admin\"\n}\n\nawait database.update(\"users\", { object: user, condition: \"id = 1\"})\n\n```\n\n#### Tips\nIf you can't find the function that you require or a bug then feel free to use your own query with the request function.\n\u003cbr\u003e\nYou don't need to worry about database timeouts since this module does handle connections automatically for you!\n\u003cbr\u003e\nAnd also try to add the issue to the Repository so it can get into this module.\n\n```js\nawait database.request(`your own query`)\n```\n\n#### Contribute\n\nWe would love to extend our functionality with you as contributer.\n\u003cbr\u003e\nIf you got any ideas open a pull request and we see how we can implement it!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalemy%2Fmysql-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalemy%2Fmysql-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalemy%2Fmysql-commands/lists"}