fix async oper

This commit is contained in:
jxxghp
2025-07-30 18:48:50 +08:00
parent edec18cacb
commit 48d353aa90
6 changed files with 40 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
import asyncio
from typing import Any, Generator, List, Optional, Self, Tuple, AsyncGenerator, Sequence
from typing import Any, Generator, List, Optional, Self, Tuple, AsyncGenerator, Sequence, Union
from sqlalchemy import NullPool, QueuePool, and_, create_engine, inspect, text, select, delete
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
@@ -428,14 +428,5 @@ class DbOper:
数据库操作基类
"""
def __init__(self, db: Session = None):
self._db = db
class AsyncDbOper:
"""
异步数据库操作基类
"""
def __init__(self, db: AsyncSession = None):
def __init__(self, db: Union[Session, AsyncSession] = None):
self._db = db