tests user_with_load
This commit is contained in:
@@ -26,9 +26,12 @@ class BaseRepo(Generic[ModelType]):
|
||||
statement = insert(self.model).values(data).returning(self.model)
|
||||
result = await self.session.execute(statement)
|
||||
obj: ModelType = result.scalar_one()
|
||||
print(obj)
|
||||
return obj
|
||||
|
||||
async def create_bulk(self, data: Sequence[Mapping[str, Any]]) -> list[ModelType]:
|
||||
result = [await self.create_one(item) for item in data]
|
||||
return result
|
||||
|
||||
async def get_one_or_none(self, **filter_by: Any) -> ModelType | None:
|
||||
query = select(self.model).filter_by(**filter_by)
|
||||
result = await self.session.execute(query)
|
||||
|
||||
Reference in New Issue
Block a user