{"id":31921984,"url":"https://github.com/xexi/evens","last_synced_at":"2026-05-14T20:04:12.706Z","repository":{"id":57231166,"uuid":"83007932","full_name":"xexi/evens","owner":"xexi","description":"unleash the power of event","archived":false,"fork":false,"pushed_at":"2019-02-20T01:38:56.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-23T12:56:02.779Z","etag":null,"topics":["event-driven","event-emitter","mysql-orm","node-js","nodejs-modules"],"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/xexi.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":"2017-02-24T06:12:46.000Z","updated_at":"2020-08-05T07:27:07.000Z","dependencies_parsed_at":"2022-09-04T15:04:39.801Z","dependency_job_id":null,"html_url":"https://github.com/xexi/evens","commit_stats":null,"previous_names":["seeisexist/evens"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xexi/evens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xexi%2Fevens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xexi%2Fevens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xexi%2Fevens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xexi%2Fevens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xexi","download_url":"https://codeload.github.com/xexi/evens/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xexi%2Fevens/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017086,"owners_count":26085984,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["event-driven","event-emitter","mysql-orm","node-js","nodejs-modules"],"created_at":"2025-10-13T22:56:00.599Z","updated_at":"2025-10-13T22:56:09.402Z","avatar_url":"https://github.com/xexi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/xexi/evens.svg?branch=master)](https://travis-ci.org/xexi/evens) \u0026nbsp;\u003ca href=\"https://snyk.io/test/github/xexi/evens\"\u003e\u003cimg src=\"https://snyk.io/test/github/xexi/evens/badge.svg\" alt=\"Known Vulnerabilities\" data-canonical-src=\"https://snyk.io/test/github/xexi/evens\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\u003cbr\u003e\n\u003cimg src=\"http://postfiles5.naver.net/MjAxNzAzMTVfMjMz/MDAxNDg5NTY4NjY0OTEw.NW1l-5VOppvl5pdxBfUnBJGv5bmnM7NM6sPoUr4fNQwg.c44oVld7u1gitW1YDpk-B9qGKrTKlkqSrfkjGpQyllYg.PNG.synth9/ev.PNG?type=w2\"\u003e\u003c/img\u003e\n\u003cbr\u003e\n\u003cbr\u003e\u003cb\u003eSimple handling of sql queries in nodejs code\u003c/b\u003e\n\u003cbr\u003e\u003cbr\u003e\n\u003cimg src=\"http://postfiles16.naver.net/MjAxNzEwMTVfMTQ0/MDAxNTA4MDE5Nzg3NTUw.flwAWyTeSFo8dqq3rtpd_ubCECFDmnNNaB3174lvBB0g.LY5gvl-JfjaojhtsIWlvS3HRUnTjvIGE9seXarOoqaEg.JPEG.synth9/ori.JPG?type=w2\"\u003e\u003c/img\u003e\n\u003cb\u003e⇩⇩⇩⇩⇩⇩⇩⇩ simplify ⇩⇩⇩⇩⇩⇩⇩⇩\u003c/b\u003e\n===================\n\u003cimg src=\"http://postfiles13.naver.net/MjAxNzEwMTVfMjg4/MDAxNTA4MDE5ODMyOTE5.Rkwc3ftBAztDb1ZHPku9au6WLSnh6Yr_3foE1WiC4XAg.heV9EJpnWT5ic_kPC-EJ955uQWVjQs-7Dr5CJnzNTQgg.JPEG.synth9/ori2.JPG?type=w2\"\u003e\u003c/img\u003e\n\u003cbr\u003e\n\u003e *Note: * \u003cb\u003e evens takes care of of these things. \u003c/b\u003e\n\u003e\u003e \u003cb\u003eYou don't need to worry about \u003c/b\u003e:\n\u003e\u003e\u003e - **Connection management** (release or close)\n\u003e\u003e\u003e - **Commit**\n\u003e\u003e\u003e - **Rollback**\n\u003e\u003e\u003e - **Error handling**\n\n\u003cbr\u003e\n#### \u003cb\u003eHow to Use ? \u003c/b\u003e\u003cbr\u003e\u003cbr\u003e\nsample DB\n\u003cbr\u003e\n\u003cimg src=\"http://postfiles12.naver.net/MjAxNzAzMjJfNSAg/MDAxNDkwMTUwODY4MTQ4.Z5KxDrrNyRgB42XJMAkGEPAT88DD8nWrhaHgWWQdNQsg.g9mqlU1JUriax-jNoBElUIfiyVRiXgVSz7V0uj9dmU4g.PNG.synth9/dd.PNG?type=w2\"\u003e\u003c/img\u003e\n\n# simple query\n```\n\"use strict\";\nlet evens = require('evens').mysql;\nlet t = new evens({ host: '127.0.0.1', user: , password: , .... });\n\nlet plan = [ { query: 'SELECT * FROM gym'}]; // add more query by { query: 'blabla' }\nt.query(plan);\nt.on('end', (r)=\u003e{ console.log(r.esult); });\n```\n\u003cbr\u003e\u003cbr\u003e\n\n# advanced query\n```\n\"use strict\";\nlet evens = require('evens').mysqlPool;\nconst mysql = require('mysql');\nconst pool = mysql.createPool({\n  connectionLimit : 10,\n  host     : '127.0.0.1', \n  user     : 'example',\n  password : 'your_password',\n  port     : 3306,\n  database : 'your_db'\n});\n\nlet plan = [ {\n  query: { sql: 'UPDATE gym SET name = ? WHERE id = \\'bird\\'', timeout : 500000 },\n  values: ['gym'],\n  cData: { switch : 'off' } // must assign if you're going to use data chainning\n}, {\n  query: 'SELECT * FROM gym '\n}, {\n  customData : [ 1 ],\n  customQuery : (data) =\u003e {\n    // just give a number to customData you can retrive all plan[1] query result \n    if(data){\n      return { query: 'SELECT * FROM gym '};\n    } else {\n      return 'pass'; /* must consider customData exception \n                        by 'pass' command you can just skip this query\n                        or you can just quit process and end connection by 'end' command */\n    }\n  }\n}, {\n  // if query result not matched do not query\n  customData : [ { 1: 'name'} ], // you can set static value or query result ( obj,str,arr )\n  customQuery : (data, cData) =\u003e{\n    if(data[0]==='gym'){\n      cData['switch'] = 'on'; // let's get more tricky\n      return {\n        query: 'SELECT * FROM ' + data[0],\n        cData: cData \n      };\n    } else {\n      return 'pass'; \n    }\n  }\n}, {\n  customQuery : (data, cData)=\u003e{\n    if(cData.switch==='on') return {query: 'SELECT * FROM day'}; // you can change program flow by cData   \n  }\n} ];\n\nlet Q = new evens(pool, {queryTimeout: 10000}); // set general query timeout\nQ.query(plan);\nQ.on('end', (r)=\u003e{\n  if(r.success){\n    console.log(r.esult);    \n  } else {\n    console.log(JSON.stringify(r)); // err\n  }\n});\n```\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxexi%2Fevens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxexi%2Fevens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxexi%2Fevens/lists"}