{"id":19090786,"url":"https://github.com/backendexpert/mysql-easy","last_synced_at":"2026-01-05T00:35:52.482Z","repository":{"id":238677824,"uuid":"797217244","full_name":"BackendExpert/mysql-easy","owner":"BackendExpert","description":"NPM Package for Mysql Node ","archived":false,"fork":false,"pushed_at":"2024-05-25T13:38:12.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-14T02:03:24.575Z","etag":null,"topics":["backend-development","expressjs","javascript","mysql","node-js","npm-package"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jkmysql-easy","language":"JavaScript","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/BackendExpert.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-05-07T12:21:51.000Z","updated_at":"2024-05-25T13:43:03.000Z","dependencies_parsed_at":"2024-09-25T04:28:13.237Z","dependency_job_id":"88e49e6d-49c7-4006-8640-3e65623b772a","html_url":"https://github.com/BackendExpert/mysql-easy","commit_stats":null,"previous_names":["backendexpert/mysql-easy"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendExpert%2Fmysql-easy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendExpert%2Fmysql-easy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendExpert%2Fmysql-easy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendExpert%2Fmysql-easy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BackendExpert","download_url":"https://codeload.github.com/BackendExpert/mysql-easy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245047322,"owners_count":20552356,"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":["backend-development","expressjs","javascript","mysql","node-js","npm-package"],"created_at":"2024-11-09T03:09:45.982Z","updated_at":"2026-01-05T00:35:52.457Z","avatar_url":"https://github.com/BackendExpert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JKMySQL Easy \n\n- This is the one of Backend Support NPM Package with Node.js\n- in this package the developer not need to type sql Queries\n\n## Releases\n\n### v1.0.0 - 07 May 2024 \n\n- initial release of Project\n\n### v1.1.0 - 17 May 2024 \n\n- Updating NPM Package\n- Adding Sending Email\n\n### v1.2.0 - 23 May 2024 \n\n- Updating NPM Package\n- Adding Select Data by AND , OR\n\n### v1.3.0 - 24 May 2024 \n\n- Updating NPM Package\n- Adding Search data Function\n\n## Documentation\n\n- in order to this NPM package there are 6 functions\n\n### v1.0.0 - 07 May 2024 \n\n| Function | Description |\n|-----|------|\n| ConnectToDatabase(host, user, password, database) | to connect to Mysql Server |\n| SelectAllData(connection, tableName, callback) | Select all data in named table in database | \n| SelectData(connection, tableName, columnsData, callback) | Select one Recode according to Given column and value |\n| insertData(connection, tableName, data, callback) | Insert data to named table |\n| updateDataById(connection, tableName, UpdateColumn, id, newData, callback) | Update the data according to given column and value |\n| deleteDataById(connection, tableName, DeleteColumn, id, callback) | Delete the data according to given column and value |\n\n\n### v1.1.0 - 17 May 2024 \n\n| Function | Description |\n|-----|------|\n| SendEmailConfig(EmailService, from, Senderpass) | confiarate the email trasnporter |\n| SendEmailTo(transporter, EmailFrom, EmailTo, EmailSubject, EmailBody) | Sending Email in Here 5 Veriables |\n\n\n### v1.2.0 - 23 May 2024 \n\n| Function | Description |\n|-----|------|\n| SelectByAnd(connection, tableName, dataColumns, conditions, callback) | AND operation Select Data |\n| SelectByOR(connection, tableName, dataColumns, conditions, callback) | OR operation Select Data |\n\n\n### v1.3.0 - 24 May 2024 \n\n| Function | Description |\n|-----|------|\n| SearchData(connection, tableName, searchColumns, callback) | Seacrch data using LIKE |\n\n### v1.4.0 - 25 May 2024 \n\n| Function | Description |\n|-----|------|\n| CountData(connection, tableName, conditions, callback) | Countdata function |\n\n\n\n## Function Explain\n\n### ConnectToDatabase(host, user, password, database)\n\n- This function help to make connection between node.js and the mysql Database \n- in this function have 4 return values\n\n- - host - your_host (mostly localhost )\n- - user - your_user (user )\n- - password - your_password (password of database )\n- - database - your_database name (name of the Database )\n\n### SelectAllData(connection, tableName, callback)\n\n- This function to get all data in given table (view all data in selected table)\n- - connection - for connection function\n- - tableName - selected talbe\n- - callback - return data\n- if no data return will be 0\n\n### SelectData(connection, tableName, columnsData, callback)\n\n- same as above function\n- This function will get only selected row data \n- - connection - for connection function\n- - tableName - selected talbe\n- - columnsData - selected column\n- - callback - return data\n- if no data return will be 0\n\n### insertData(connection, tableName, data, callback)\n\n- This function help to insert data to database table\n- - connection - for connection function\n- - tableName - selected talbe\n- - data - data that want to insert to database\n- - callback - return message\n\n### updateDataById(connection, tableName, UpdateColumn, id, newData, callback)\n\n- This function help to update data according to given column and value in named table\n- - connection - for connection function\n- - tableName - selected talbe\n- - UpdateColumn - the column name that want to update\n- - id - the column data that want to update\n- - newData - data that want to update \n- - callback - return message\n\n\u003chr\u003e\n\n### SendEmailConfig(EmailService, from, Senderpass)\n\n- This function configarate the email environment in nodejs\n- EmailService - mostly (Gmail) Plesase use Gmail other services are not still working\n- from - senders email address (this in .env file)\n- Senderpass - your App Password (this in .env file)\n\n\n\n### SendEmailTo(transporter, EmailFrom, EmailTo, EmailSubject, EmailBody)\n\n- IMPORTANT - you must use transporter as veriable in nodejs othervise this not working\n\n- This function help to send the Email\n- transporter - when you create the configaration of the email sending `SendEmailConfig(EmailService, from, Senderpass)`\n- EmailFrom - same as from in `SendEmailConfig(EmailService, from, Senderpass)`\n- EmailTo - you want to send email (receiver of email)\n- EmailSubject - subject of the Email\n- EmailBody - body (content of the Email)\n\n\u003chr\u003e\n\n### function SelectByAnd(connection, tableName, dataColumns, conditions, callback)\n\n- in this function has 5 veriables\n- AND operation Select Data\n\n### function SelectByOR(connection, tableName, dataColumns, conditions, callback)\n\n- in this function has 5 veriables\n- OR operation Select Data\n\n### IMPORTANT\n\n- if you want to get all data via these 2 funtion you have to mention dataColumns and conditions as empty veriables if not this will not working\n\n\n\u003chr\u003e\n\n### SearchData(connection, tableName, searchColumns, callback)\n\n- This function has 4 veriables\n- - connection for connect database\n- - tableName for name of the table you need to search data\n- - searchColumns for colums that you use to seach data\n- - callback for get the result\n\n\u003chr\u003e\n\n### CountData(connection, tableName, conditions, callback)\n\n- This function has 4 veriables\n- - connection for connect database\n- - tableName for name of the table you need to search data\n- - conditions that you need to filter data\n- - callback for get the result\n\n\n\n## How to use\n\n- install the package\n\n```js\n\n    npm i jkmysql-easy\n\n```\n\n- in server.js file in backend (node.js)\n\n``` js \n\nconst JKMysql = require('jkmysql-easy');\n\n```\n\n- and then work of functions\n\n``` js \n\n// function for SelectAllData\n\nconst tableName = 'name_of_the_table';\n\nJKMysql.SelectAllData(connection, tableName, (results) =\u003e {\n    console.log('The Fetched Data:', results);\n})\n\n\n// function for SelectData\n\nconst tableName = 'name_of_the_table';\nconst columnsData = { email: \"email2@123.com\" }; // Example columns data object\n\nJKMysql.SelectData(connection, tableName, columnsData, (results) =\u003e {\n    console.log('The Fetched Data:', results);\n})\n\n\n// function for insertData\n\nconst tableName = 'users';\nconst data = { username: 'John', email: 'email2@123.com', create_at: new Date(), role: \"user\", is_active: 1, password: '123'};\n        \nJKMysql.insertData(connection, tableName, data, (insertedId) =\u003e {\n    console.log('Data Enterd Successful');\n});\n\n// function for updateDataById\n\nconst tableName = \"users\"\nconst idToUpdate = \"email2@123.com\"\nconst updateColumn = \"email\"\nconst newData = { username: 'Amara', role: \"SuperAdmin\" };\n\nJKMysql.updateDataById(connection, tableName, updateColumn, idToUpdate, newData, (affectedRows) =\u003e {\n    console.log('Data Updated Successful');\n});\n\n// function for updateDataById\n\n\nconst tableName = 'users';\nconst emailtoDelete = 'email@123.com'; // The ID of the row you want to update\nconst DeleteColumn = 'email'\n\nJKMysql.deleteDataById(connection, tableName, DeleteColumn, emailtoDelete, (affectedRows) =\u003e {\n    console.log('Recode Deleted Succefull');\n});\n\n\n```\n\n### v1.1.0 functions\n\n``` js \n\nconst JKMysql = require('jkmysql-easy');\n\n// configarate the email\n// you must use veriable as `transporter` if not this will not working\nconst transporter = JKmysql.SendEmailConfig(\"Gmail\", process.env.EMAIL_USER, process.env.EMAIL_PASSWORD)\n\n// sending email\n\nconst EmaiMe = \"exmple@123.com\"\nconst EmailMeSubject = \"Successfully work jkmysqlEasy\"\nconst EmalmeBody = \"Working Successful\"\n\n\n// you must use veriable as `transporter` if not this will not working\nJKmysql.SendEmailTo(transporter, process.env.EMAIL_USER, EmaiMe, EmailMeSubject, EmalmeBody)\n\n// optional\nreturn res.json({Status: \"Success\"})\n\n\n\n```\n \n\n### v1.2.0 functions\n\n``` js \n\nconst JKMysql = require('jkmysql-easy');\n\n// AND opertaion Select data\n\nconst tableName = 'tableName'\nconst columns = []\nconst conditions = {\n    coloumn: \"coloumn\",\n    coloumn: \"coloumn\",\n}\nJKmysql.SelectDataAnd(connection, tableName, columns, conditions, (query) =\u003e {\n    console.log(query)\n})\n\n// if you want to get all data set columns and conditions as empty \n// if you not mentions the columns and conditions this will not warking\n\n// OR opertaion Select data\n\nconst tableName = 'tableName'\nconst columns = []\nconst conditions = {\n    coloumn: \"data\",\n    coloumn2: \"data2\"\n}\nJKmysql.SelectDataOR(connection, tableName, columns, conditions, (query) =\u003e {\n    console.log(query)\n})\n\n// if you want to get all data set columns and conditions as empty \n// if you not mentions the columns and conditions this will not warking\n\n\n```\n\n\n### v1.3.0 functions\n\n``` js \n\nconst JKMysql = require('jkmysql-easy');\n\nconst tableName = \"tableName\"\nconst searchColumns = {\n    coloumn: \"data\",\n    coloumn2: \"data2\"\n}\nJKmysql.SearchData(connection, tableName, searchColumns, (result) =\u003e {\n    console.log(result)\n})\n\n```\n\n\n### v1.4.0 functions\n\n``` js \n\nconst JKMysql = require('jkmysql-easy');\n\nconst tableName = 'tableName'\n\n// if you not need to use conditions keep the condition as empty\n// if you not mentions the conditions veriable the function not working\nconst conditions = []\n\nJkMysql.CountData(connection, tableName, conditions, (result) =\u003e {\n    if(result){\n        return res.json({StdResult: result})\n    }\n})\n\n```\n\n\n\n\n## Developers\n\n- [JehanKandy](https://github.com/BackendExpert) - Developer\n- [Anupa Gamage](https://github.com/Anupa1998) - Developer","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackendexpert%2Fmysql-easy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbackendexpert%2Fmysql-easy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackendexpert%2Fmysql-easy/lists"}