Metadata-Version: 2.1
Name: nonebot-plugin-tortoise-orm
Version: 0.0.1a3
Summary: 一个通用数据库连接插件
Home-page: https://github.com/kexue-z/nonebot-plugin-tortoise-orm
License: MIT
Author: kexue
Author-email: x@kexue.io
Requires-Python: >=3.7.3,<4.0.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: aiomysql (>=0.1.1,<0.2.0)
Requires-Dist: aiosqlite (>=0.17.0,<0.18.0)
Requires-Dist: nonebot2 (>=2.0.0-beta.1,<3.0.0)
Requires-Dist: tortoise-orm[asyncpg] (>=0.19.1,<0.20.0)
Description-Content-Type: text/markdown

# 通用 ORM 数据库连接插件

> 施工中。。。

- 参考 [example_bot](example_bot) 来创建一个 _聊天记录_ 插件吧~！

## `.env` 设置

参考配置：

```ini
# db_url=postgres://postgres@localhost:5432/postgres
db_url=sqlite://db.sqlite3
db_generate_schemas=false
```

### `db_url`

#### 使用 `sqlite`

直接使用相对路径来建立

```ini
db_url=sqlite://db.sqlite3
```

如果时指定路径，则应该是

```ini
db_url=sqlite:///data/db.sqlite
```

使用绝对路径 注意有三个 `/`

#### 使用 `PostgreSQL`

```ini
db_url=postgres://postgres:pass@db.host:5432/somedb
```

- 说明： `postgres://` 表示协议
- `postgres:pass@` 表示登入账号和密码 如果没有密码则用 `postgres@`
- `db.host:5432` 表示数据库的地址 和 端口 如果是本机 则为 `localhost:5432`
- `/somedb` 表示数据库名

#### 使用 `MySQL/MariaDB`

```ini
db_url=mysql://myuser:mypass:pass@db.host:3306/somedb
```

跟上面的差不多

## 数据库类型

- [x] postgres
- [x] sqlite
- [x] MySQL/MariaDB

其他待补充

