{"id":22246119,"url":"https://github.com/anyrequest/sqlistener","last_synced_at":"2025-03-25T11:23:45.179Z","repository":{"id":182375918,"uuid":"668335756","full_name":"AnyRequest/SQListener","owner":"AnyRequest","description":"A plugin that uses SQL to detect when a change, modify, delete, etc. query occurs.","archived":false,"fork":false,"pushed_at":"2023-07-23T05:44:42.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T01:27:26.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/AnyRequest.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":"2023-07-19T15:02:51.000Z","updated_at":"2023-07-19T18:03:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f613b4a-96bc-4a72-b670-5d0cec829654","html_url":"https://github.com/AnyRequest/SQListener","commit_stats":null,"previous_names":["anyrequest/sqlistener"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnyRequest%2FSQListener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnyRequest%2FSQListener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnyRequest%2FSQListener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnyRequest%2FSQListener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnyRequest","download_url":"https://codeload.github.com/AnyRequest/SQListener/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245450654,"owners_count":20617387,"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-12-03T05:26:08.648Z","updated_at":"2025-03-25T11:23:45.131Z","avatar_url":"https://github.com/AnyRequest.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQListener\n\nA plugin that uses SQL to detect when a change, modify, delete, etc. query occurs.\n\n## Version\n\n0.0.2\n\n## Usage\n\n```bash\nnpm install --save sqlistener\n```\n\n현재 MySQL, MariaDB에서만 가능하며 사용법은 아래와 같습니다.\n\n```javascript\nimport express from \"express\";\nimport SQListener from \"../src/index\";\nimport mysql from \"mysql2\";\nimport User from \"./model/User\";\n\nconst DB_CONFIG = {\n  host: \"localhost\",\n  port: 3307,\n  database: \"db_name\",\n  user: \"root\",\n  password: \"password\",\n};\n\nconst conn = mysql.createConnection(DB_CONFIG);\n\nconn.connect();\n\nconst app = express();\n\n/* 리스너 초기화 */\nconst listener = new SQListener(app);\nlistener.init({\n  type: \"mysql2\",\n  ...DB_CONFIG,\n});\n/* 이벤트 감지 시작 */\nlistener.watch([Model, ...]);\n\n/* 이벤트 추가 */\nlistener.addEventListener(\"query\", \"user\", (type, name, index) =\u003e {\n  console.log(\"추가 감지!\", this, type, name, index);\n});\n\napp.get(\"/\", (req, res) =\u003e {\n  console.log(\"hello world\");\n  res.send(\"done\");\n});\napp.post(\"/\", (req, res) =\u003e {\n  conn.query(`INSERT INTO user (name) values('kimson')`);\n  res.send(\"done\");\n});\n\napp.listen(9090, () =\u003e {\n  console.log(\"listening on http://localhost:9090\");\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanyrequest%2Fsqlistener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanyrequest%2Fsqlistener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanyrequest%2Fsqlistener/lists"}