适用于 Nonebot2 的数据存储插件
Project description
NoneBot Plugin DataStore
✨ NoneBot 数据存储插件 ✨
使用方式
加载插件后直接导出方法
from nonebot.params import Depends
from nonebot_plugin_localstore import PluginData, get_session
from sqlmodel.ext.asyncio.session import AsyncSession
DATA = PluginData("plugin_name")
@matcher.handle()
def handle(session: AsyncSession = Depends(get_session)):
await session.exec()
配置项
配置方式:直接在 NoneBot
全局配置文件中添加以下配置项即可。
datastore_cache_dir
- 类型:
str
- 默认: nonebot_plugin_localstore 插件提供的缓存目录
- 说明: 缓存目录
datastore_config_dir
- 类型:
str
- 默认: nonebot_plugin_localstore 插件提供的配置目录
- 说明: 配置目录
datastore_data_dir
- 类型:
str
- 默认: nonebot_plugin_localstore 插件提供的数据目录
- 说明: 数据目录
datastore_enable_database
- 类型:
bool
- 默认:
False
- 说明: 是否启动数据库
datastore_database_url
- 类型:
str
- 默认:
sqlite+aiosqlite:///data_dir/data.db
- 说明: 数据库连接字符串,默认使用 SQLite 数据库
datastore_database_echo
- 类型:
bool
- 默认:
False
- 说明: 是否显示数据库执行的语句与其参数列表
计划
- 调整配置为 K-V 存储
- 调整配置存放位置至专门的配置目录
- 数据库为可选项
- 支持将配置存放至数据库中
- 支持 Alembic
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
Close
Hashes for nonebot-plugin-datastore-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad2e9584fe0e85b1057d391d7f3b2ba3ba96a4882e11e9894b311240558d5e9d |
|
MD5 | 330a2e454881db982aca00d561b9396e |
|
BLAKE2b-256 | e929c4d65bdb6a99d1328b6096463fa87006eabb92881ba6c91710ecd0c7044a |
Close
Hashes for nonebot_plugin_datastore-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd63f5c6bbd75d44ecf53127c45b6d8a1a51d3a842fb0a9fe865923f2ef19289 |
|
MD5 | 1c4fd694788631e6af26da9e21116174 |
|
BLAKE2b-256 | 8c9273000c33cacbd64477ca4998a18df2c2289fd1f25bddf0a1a3149037b17e |