- Implemented TableBaseMixin providing generic CRUD methods and automatic timestamp management. - Introduced UUIDTableBaseMixin for models using UUID as primary keys. - Added ListResponse for standardized paginated responses. - Created TimeFilterRequest and PaginationRequest for filtering and pagination parameters. - Enhanced get_with_count method to return both item list and total count. - Included validation for time filter parameters in TimeFilterRequest. - Improved documentation and usage examples throughout the code.
15 lines
285 B
Python
15 lines
285 B
Python
"""
|
||
通用响应模型定义
|
||
"""
|
||
import uuid
|
||
|
||
from sqlmodel import Field
|
||
|
||
from .base import SQLModelBase
|
||
|
||
class ResponseBase(SQLModelBase):
|
||
"""通用响应模型"""
|
||
|
||
instance_id: uuid.UUID = Field(default_factory=uuid.uuid4)
|
||
"""实例ID,用于标识请求的唯一性"""
|