{"id":16217252,"url":"https://github.com/synodriver/nonebot_plugin_navicat","last_synced_at":"2025-03-19T10:30:42.642Z","repository":{"id":55840493,"uuid":"319908493","full_name":"synodriver/nonebot_plugin_navicat","owner":"synodriver","description":"database plugin for nonebot2","archived":false,"fork":false,"pushed_at":"2023-06-25T08:53:47.000Z","size":56,"stargazers_count":22,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"rc","last_synced_at":"2024-06-10T10:49:20.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synodriver.png","metadata":{"files":{"readme":"README.markdown","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":"2020-12-09T09:38:34.000Z","updated_at":"2024-02-05T16:52:42.000Z","dependencies_parsed_at":"2024-10-10T11:26:22.225Z","dependency_job_id":"d78e59e0-3a9b-4c7c-9d4b-21f21b590b21","html_url":"https://github.com/synodriver/nonebot_plugin_navicat","commit_stats":{"total_commits":18,"total_committers":4,"mean_commits":4.5,"dds":0.2222222222222222,"last_synced_commit":"f288a9936616d731934835092d025d41671d1e2a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fnonebot_plugin_navicat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fnonebot_plugin_navicat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fnonebot_plugin_navicat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fnonebot_plugin_navicat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synodriver","download_url":"https://codeload.github.com/synodriver/nonebot_plugin_navicat/tar.gz/refs/heads/rc","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243982182,"owners_count":20378605,"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-10-10T11:26:17.412Z","updated_at":"2025-03-19T10:30:42.325Z","avatar_url":"https://github.com/synodriver.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nonebot_plugin_navicat\n[![pypi](https://img.shields.io/pypi/v/nonebot-plugin-navicat.svg)](https://pypi.org/project/nonebot_plugin_navicat/) \n![implementation](https://img.shields.io/pypi/implementation/nonebot-plugin-navicat)\n![wheel](https://img.shields.io/pypi/wheel/nonebot-plugin-navicat)\n![python](https://img.shields.io/pypi/pyversions/nonebot-plugin-navicat)\n[![license](https://img.shields.io/github/license/synodriver/nonebot_plugin_navicat.svg)](https://raw.githubusercontent.com/synodriver/nonebot_plugin_navicat/main/LICENSE)\n\n- 基于[nonebot2](https://github.com/nonebot/nonebot2)\n\n## 功能\n\n- 对外暴露出数据库连接 支持mysql mongodb redis\n\n## 开始使用\n\n必须使用 pip\n\n- 通过 pip 从 [PyPI](https://pypi.org/project/nonebot_plugin_navicat/) 安装\n\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat\n```\n- 我全都要\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat[all]\n```\n- 要使用mysql\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat[mysql]\n```\n- 要使用postgresql\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat[postgresql]\n```\n- 要使用sqlite\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat[sqlite]\n```\n- 要使用mongodb\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat[mongodb]\n```\n- 要使用redis\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat[redis]\n```\n- 要使用elasticsearch\n``` {.sourceCode .bash}\npip install nonebot-plugin-navicat[elasticsearch]\n```\n\n- 在 nonebot2 项目中设置 load_plugin()\n\n``` {.sourceCode .python}\nnonebot.load_plugin('nonebot_plugin_navicat')\n```\n\n- 参照下文在 nonebot2 项目的环境文件 .env.\\* 中添加配置项\n\n## 配置项\n配置数据库连接\n```\n# mysql 如果有MYSQL_HOST则表示要进行mysql连接\nMYSQL_HOST=\nMYSQL_PORT=\nMYSQL_USER=\nMYSQL_PASSWORD=\nMYSQL_DB=\n\n# postgresql 如果有PGSQL_HOST则表示要进行postgresql连接\nPGSQL_HOST=\nPGSQL_PORT=\nPGSQL_USER=\nPGSQL_PASSWORD=\nPGSQL_DB=\n\n# sqlite 如果有SQLITE_HOST则表示要进行sqlite连接 这里是路径\nSQLITE_HOST=\n\n# mongodb 如果有MONGODB_HOST则表示要进行mongodb连接\nMONGODB_HOST=\nMONGODB_PORT=\nMONGODB_USER=\nMONGODB_PASSWORD=\n\n# redis 如果有REDIS_HOST则表示要进行redis连接\nREDIS_PARAMS={\"decode_responses\":true}\nREDIS_HOST=\nREDIS_PORT=\nREDIS_PASSWORD=\nREDIS_DB=\n\n# redis sentinel 如果有REDIS_SENTINEL_PARAMS则表示要进行redis sentinel连接\nREDIS_SENTINEL_PARAMS=\nREDIS_SENTINEL_SERVICE_NAME=    # 必填\n\n# redis cluster 如果有REDIS_CLUSTER_PARAMS则表示要进行redis cluster连接\nREDIS_CLUSTER_PARAMS=\nREDIS_CLUSTER_NODES=\n# 集群没有db选项\n\n# elasticsearch 如果有ELASTICSEARCH_PARAMS则表示要进行elasticsearch连接\nELASTICSEARCH_PARAMS=\nELASTICSEARCH_HOSTS=\n\n\n# 以后会加入更多数据库支持\n```\n## 导出给其他插件\n\n```{.sourceCode .python}\nfrom nonebot import require\n\nrequire(\"nonebot_plugin_navicat\")\nimport nonebot_plugin_navicat as export # 兼容老写法，不至于大改\n\nexport.mysql_pool # mysql的\n\nexport.pgsql_pool # postgresql的\n\nexport.sqlite_pool # sqlite的\n\nexport.mongodb_client # mongodb的\n\nexport.redis_client # redis的\nexport.redis_sentinel\nexport.redis_cluster\n\nexport.elasticsearch # elasticsearch的\n```\n\n## 直接查询数据库 (0.2.0中已删除)\n- 危险功能! 在配置中启用```NAVICAT_EXECUTE_SQL=true```来开启\n- 使用方法:发送```super ${dbname} + sql```来查询\n```\nsuper mysql\nshow databases\n```\n## 更新记录\n- v0.4.0 **breaking** 使用异步redis库\n\n- v0.3.0rc1 适配nonebot rc版本\n\n- v0.2.3 修复beta2的bug\n\n\n- v0.2.1 加入了对redis哨兵和集群的支持，对```elasticsearch```的支持\n\n\n\n- v0.2.0 使用 [databases](https://github.com/encode/databases/) 代替直接连接,有了广泛的通用性\n- 移除了直接命令行查询数据库的功能,迁移到了单独的一个插件里面 *[nonebot-plugin-super](https://github.com/synodriver/nonebot_plugin_super)*\n## 特别感谢\n\n- [Mrs4s / go-cqhttp](https://github.com/Mrs4s/go-cqhttp)\n- [nonebot / nonebot2](https://github.com/nonebot/nonebot2)\n\n## 优化建议\n\n- bug report\n- more databases support\n![](https://i.pixiv.cat/img-original/img/2018/08/29/00/16/10/70434240_p0.png \"bug哪里跑 看姐姐给你们全抓起来~\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fnonebot_plugin_navicat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynodriver%2Fnonebot_plugin_navicat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fnonebot_plugin_navicat/lists"}