MCPcopy
hub / github.com/tortoise/tortoise-orm / first

Method first

tortoise/queryset.py:824–829  ·  view source on GitHub ↗

Limit queryset to one object and return one object instead of list.

(self)

Source from the content-addressed store, hash-verified

822 return RawSQLQuery(model=self.model, db=self._db, sql=sql)
823
824 def first(self) -> QuerySetSingle[MODEL | None]:
825 """
826 Limit queryset to one object and return one object instead of list.
827 """
828 queryset = self._clone()
829 return queryset._as_single()
830
831 def last(self) -> QuerySetSingle[MODEL | None]:
832 """

Callers

nothing calls this directly

Calls 2

_cloneMethod · 0.95
_as_singleMethod · 0.80

Tested by

no test coverage detected