{"id":13776862,"url":"https://github.com/myselfghost/lua-resty-mysql-connector","last_synced_at":"2025-05-11T10:31:25.152Z","repository":{"id":202543771,"uuid":"130029568","full_name":"myselfghost/lua-resty-mysql-connector","owner":"myselfghost","description":"Connection utilities for lua-resty-mysql,support for read and write separation，support for instantiating different databases","archived":false,"fork":false,"pushed_at":"2018-04-18T08:46:36.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-14T18:34:39.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/myselfghost.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}},"created_at":"2018-04-18T08:26:07.000Z","updated_at":"2018-04-18T08:46:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"387df494-51a9-463f-af32-cf7d642b2f6d","html_url":"https://github.com/myselfghost/lua-resty-mysql-connector","commit_stats":null,"previous_names":["myselfghost/lua-resty-mysql-connector"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myselfghost%2Flua-resty-mysql-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myselfghost%2Flua-resty-mysql-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myselfghost%2Flua-resty-mysql-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myselfghost%2Flua-resty-mysql-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myselfghost","download_url":"https://codeload.github.com/myselfghost/lua-resty-mysql-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253551763,"owners_count":21926353,"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-08-03T18:00:34.115Z","updated_at":"2025-05-11T10:31:24.374Z","avatar_url":"https://github.com/myselfghost.png","language":"Lua","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# lua-resty-mysql-connector\nConnection utilities for lua-resty-mysql,support for read and write separation，support for instantiating different databases\n# Methods\n\n## new\n\n```\nsyntax: yourdb = db:new(database)\n```\nif there is not a database name, database = \"default\"\n\n```\nlocal libmysql = require(\"libmysql\")\nlocal db_member = libmysql:new(\"member\")\nlocal db_test = libmysql:new()\n```\n\n## query\n\n```\nsyntax: res, err = yourdb:query(\"select des from test1 where test_id=? \", {3})\n```\nSome read database operations\n## main\n```\nsyntax: res, err = yourdb:main(\"UPDATE test1 SET des='my lua' WHERE test_id=?\", {3})\n```\nSome write database operations\n\n# Synopsis\n\n```\nlocal libmysql = require(\"libmysql\")\nlocal db_member = libmysql:new(\"member\")\nlocal db_test = libmysql:new()\n\nlocal res, err =  db_member:query(\"select des from test1 where (test_id=? )\", {3})\nif err or not res or type(res)~=\"table\" or #res\u003c1 then\n   ngx.say(\"test database member query :nothing\") \nelse\n    ngx.say(\"test database member query :res\") \nend\n\nlocal res, err =  db_test:query(\"select des from test1 where test_id=? ;\", {3})\nif err or not res or type(res)~=\"table\" or #res\u003c1 then\n   ngx.say(\"test database test query :nothing\") \nelse\n    ngx.say(\"test database test query :res\") \nend\nlocal res, err =  db_test:main(\"UPDATE test1 SET des='my lua' WHERE test_id=?\", {3})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyselfghost%2Flua-resty-mysql-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyselfghost%2Flua-resty-mysql-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyselfghost%2Flua-resty-mysql-connector/lists"}