A batabase manager plugin for nonebot2,provide capability of connection to all kinds of databases
Project description
nonebot_plugin_navicat
- 基于nonebot2
功能
- 对外暴露出数据库连接 支持mysql mongodb redis
开始使用
必须使用 pip
- 通过 pip 从 PyPI 安装
pip install nonebot-plugin-navicat
- 我全都要
pip install nonebot-plugin-navicat[all]
- 要使用mysql
pip install nonebot-plugin-navicat[mysql]
- 要使用mongodb
pip install nonebot-plugin-navicat[mongodb]
- 要使用redis
pip install nonebot-plugin-navicat[redis]
- 在 nonebot2 项目中设置 load_plugin()
nonebot.load_plugin('nonebot_plugin_navicat')
- 参照下文在 nonebot2 项目的环境文件 .env.* 中添加配置项
配置项
配置数据库连接
# mysql 如果有MYSQL_HOST则表示要进行mysql连接
MYSQL_HOST
MYSQL_PORT
MYSQL_USER
MYSQL_PASSWORD
# mongodb 如果有MONGODB_HOST则表示要进行mongodb连接
MONGODB_HOST
MONGODB_PORT
MONGODB_USER
MONGODB_PASSWORD
# redis 如果有REDIS_HOST则表示要进行redis连接
REDIS_HOST
REDIS_PORT
REDIS_PASSWORD
REDIS_DB
# 以后会加入更多数据库支持
导出给其他插件
export = nonebot.require("nonebot_plugin_navicat")
export.mysql_pool # mysql的
export.mongodb_client # mongodb的
export.redis_client # redis的
特别感谢
优化建议
- 来个postgresql支持?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters