GramCore/README.md

22 lines
496 B
Markdown
Raw Normal View History

2023-08-05 02:41:12 +00:00
# core 目录说明
2023-08-05 02:41:12 +00:00
## 关于 `Service`
2023-08-05 02:41:12 +00:00
服务 `Service` 需定义在 `services` 文件夹下, 并继承 `core.service.Service`
2023-08-05 02:41:12 +00:00
每个 `Service` 都应包含 `start``stop` 方法, 且这两个方法都为异步方法
2023-08-05 02:41:12 +00:00
```python
from core.service import Service
2023-08-05 02:41:12 +00:00
class TestService(Service):
def __init__(self):
"""do something"""
2023-08-05 02:41:12 +00:00
async def start(self, *args, **kwargs):
"""do something"""
async def stop(self, *args, **kwargs):
"""do something"""
```