Return the object with the given id. Return None if not found. If `for_update` is True, the row will be locked until the end of the transaction. If `options` is provided, it will be passed to the query for eager loading relationships.
(
cls,
session: AsyncSession,
id: int,
for_update: bool = False,
options: Optional[List] = None,
)
| 113 | |
| 114 | @classmethod |
| 115 | async def one_by_id( |
| 116 | cls, |
| 117 | session: AsyncSession, |
| 118 | id: int, |
| 119 | for_update: bool = False, |
| 120 | options: Optional[List] = None, |
| 121 | ): |
| 122 | """Return the object with the given id. Return None if not found. |
| 123 | |
| 124 | If `for_update` is True, the row will be locked until the end of the transaction. |
| 125 | If `options` is provided, it will be passed to the query for eager loading relationships. |
| 126 | """ |
| 127 | |
| 128 | return await session.get(cls, id, with_for_update=for_update, options=options) |
| 129 | |
| 130 | @classmethod |
| 131 | async def first_by_field(cls, session: AsyncSession, field: str, value: Any): |
no test coverage detected