{"id":13843772,"url":"https://github.com/casbin-lua/luasql-adapter","last_synced_at":"2025-07-11T20:30:35.880Z","repository":{"id":46572585,"uuid":"391932931","full_name":"casbin-lua/luasql-adapter","owner":"casbin-lua","description":"LuaSQL adapter for Lua-Casbin","archived":false,"fork":false,"pushed_at":"2023-07-06T14:54:40.000Z","size":16,"stargazers_count":4,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-05T17:39:29.516Z","etag":null,"topics":["access-control","adapter","apisix","casbin","kong","lua","luasql","openresty","orm"],"latest_commit_sha":null,"homepage":"https://github.com/casbin/lua-casbin","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casbin-lua.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}},"created_at":"2021-08-02T12:03:56.000Z","updated_at":"2022-08-07T00:46:33.000Z","dependencies_parsed_at":"2024-02-08T21:11:40.265Z","dependency_job_id":null,"html_url":"https://github.com/casbin-lua/luasql-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-lua%2Fluasql-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-lua%2Fluasql-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-lua%2Fluasql-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin-lua%2Fluasql-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casbin-lua","download_url":"https://codeload.github.com/casbin-lua/luasql-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225755131,"owners_count":17519209,"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":["access-control","adapter","apisix","casbin","kong","lua","luasql","openresty","orm"],"created_at":"2024-08-04T17:02:26.688Z","updated_at":"2024-11-21T15:31:31.118Z","avatar_url":"https://github.com/casbin-lua.png","language":"Lua","readme":"# luasql-adapter\n\n[![GitHub Action](https://github.com/casbin-lua/luasql-adapter/workflows/test/badge.svg?branch=master)](https://github.com/casbin-lua/luasql-adapter/actions)\n[![Coverage Status](https://coveralls.io/repos/github/casbin-lua/luasql-adapter/badge.svg?branch=master)](https://coveralls.io/github/casbin-lua/luasql-adapter?branch=master)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\ncasbin-adapter is a LuaSQL based adapter for Casbin that supports policies from SQL-based databases (MySQL, PostgreSQL, SQLite3).\n\n## Installation\n\nFirst, install the corresponding driver of LuaSQL from LuaRocks based on the database you use:\n- For MySQL, install luasql-mysql.\n- For PostgreSQL, install luasql-postgres.\n- For SQLite3, install luasql-sqlite3.\n\nThen install the casbin-adapter from LuaRocks by\n```bash\nsudo luarocks install https://raw.githubusercontent.com/casbin-lua/luasql-adapter/master/casbin-adapter-1.0.0-1.rockspec\n```\n\n## Usage\n\nTo create a new Casbin Enforcer using a MySQL adapter, use:\n\n```lua\nlocal Enforcer = require(\"casbin\")\nlocal Adapter = require(\"casbin.mysql\")\n\nlocal a = Adapter:new(database, user, password, hostname, port) -- hostname, port are optional\nlocal e = Enforcer:new(\"/path/to/model.conf\", a) -- creates a new Casbin enforcer with the model.conf file and the database\n```\n\nFor other adapters, replace `local Adapter = require(\"casbin.mysql\")` with:\n- `local Adapter = require(\"casbin.postgres\")` for PostgreSQL adapter.\n- `local Adapter = require(\"casbin.sqlite3\")` for SQLite3 adapter. In SQLite3 adapter, only database field is required and others are optional.\n\n## Getting Help\n\n- [Lua Casbin](https://github.com/casbin/lua-casbin)\n\n## License\n\nThis project is under Apache 2.0 License. See the [LICENSE](https://github.com/casbin-lua/luasql-adapter/blob/master/LICENSE) file for the full license text.","funding_links":[],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin-lua%2Fluasql-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasbin-lua%2Fluasql-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin-lua%2Fluasql-adapter/lists"}