适用于 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
- 默认:
True
- 说明: 是否启动数据库
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.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ec19151774ae9fc78451633a7620b4529d703e3b3c2a45dd0ed757e00ddc64b |
|
MD5 | 45651afef69e5511fe199fe4d99e8819 |
|
BLAKE2b-256 | 79d51ad403aa1cc31695df8c1f123f58b247070363a4dc54835a2271419806bd |
Close
Hashes for nonebot_plugin_datastore-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe423c0c0edfc9a8cdfd84b1ae037e9fa7e3266e9286dd81d18c3d2e9c6cf41a |
|
MD5 | 6749e73bb3f9a16530a552b5f68e9473 |
|
BLAKE2b-256 | 091271b7161ae0799cce6aa2a9691674c653b5265f699ce856e8350b6d6c5970 |