Skip to main content

适用于 Nonebot2 的数据存储插件

Project description

nonebot

NoneBot Plugin DataStore

✨ NoneBot 数据存储插件 ✨

license pypi python

使用方式

加载插件后直接导出方法

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

datastore_config_dir

datastore_data_dir

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot-plugin-datastore-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

nonebot_plugin_datastore-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file nonebot-plugin-datastore-0.1.0.tar.gz.

File metadata

  • Download URL: nonebot-plugin-datastore-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.9 Windows/10

File hashes

Hashes for nonebot-plugin-datastore-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9136e95a434b6313f8cb646f20588c76d731b7afe84a38772bdf582e1d30772
MD5 1d4a1164be3f0bfc6c64147b8d300bfe
BLAKE2b-256 facae419f0f05e6ff23c5c9acc1107aeb1a91b2b5437189ea4862e51fcd63c91

See more details on using hashes here.

File details

Details for the file nonebot_plugin_datastore-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_datastore-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 666a0131749c0bf674b82c67a65557931c6214dd8864c16d6e3485ad25c314a5
MD5 5069305529d3165209f5ade446363c61
BLAKE2b-256 b5328543f5dd976724f8bc0fde31a9d162667276bc61532d7b8b78e955926e63

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page