File size: 579 Bytes
82f9be0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
实体信息结构
"""

from dataclasses import dataclass
from typing import Optional
import uuid


@dataclass
class EntityInfo:
    """主体信息结构"""
    id: str  # UUID格式唯一标识
    name: str  # 显示名称
    redis_host: str  # Redis服务器地址
    redis_port: int  # Redis端口
    redis_db: int  # Redis数据库编号
    channel: str  # 订阅channel名称
    
    def __post_init__(self):
        """数据验证"""
        if not self.id:
            self.id = str(uuid.uuid4())
        if not self.channel:
            self.channel = self.id