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

Method earliest

tortoise/queryset.py:503–515  ·  view source on GitHub ↗

Returns the earliest object by ordering ascending on the specified field. :params orderings: Fields to order by. :raises FieldError: If unknown or no fields has been provided.

(self, *orderings: str)

Source from the content-addressed store, hash-verified

501 return queryset._as_single()
502
503 def earliest(self, *orderings: str) -> QuerySetSingle[MODEL | None]:
504 """
505 Returns the earliest object by ordering ascending on the specified field.
506
507 :params orderings: Fields to order by.
508
509 :raises FieldError: If unknown or no fields has been provided.
510 """
511 if not orderings:
512 raise FieldError("No fields passed")
513 queryset = self._clone()
514 queryset._orderings = self._parse_orderings(orderings)
515 return queryset._as_single()
516
517 def limit(self, limit: int) -> QuerySet[MODEL]:
518 """

Callers

nothing calls this directly

Calls 4

_cloneMethod · 0.95
_parse_orderingsMethod · 0.95
FieldErrorClass · 0.90
_as_singleMethod · 0.80

Tested by

no test coverage detected