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

Method limit

tortoise/queryset.py:517–528  ·  view source on GitHub ↗

Limits QuerySet to given length. :raises ParamsError: Limit should be non-negative number.

(self, limit: int)

Source from the content-addressed store, hash-verified

515 return queryset._as_single()
516
517 def limit(self, limit: int) -> QuerySet[MODEL]:
518 """
519 Limits QuerySet to given length.
520
521 :raises ParamsError: Limit should be non-negative number.
522 """
523 if limit < 0:
524 raise ParamsError("Limit should be non-negative number")
525
526 queryset = self._clone()
527 queryset._limit = limit
528 return queryset
529
530 def offset(self, offset: int) -> QuerySet[MODEL]:
531 """

Callers 15

__getitem__Method · 0.45
test_only_advanced_limitFunction · 0.45
test_limit_countFunction · 0.45
test_limit_negativeFunction · 0.45
test_limit_zeroFunction · 0.45
test_slicing_only_limitFunction · 0.45
test_limit_offset_valuesFunction · 0.45
test_in_bulkFunction · 0.45

Calls 2

_cloneMethod · 0.95
ParamsErrorClass · 0.90

Tested by 15

test_only_advanced_limitFunction · 0.36
test_limit_countFunction · 0.36
test_limit_negativeFunction · 0.36
test_limit_zeroFunction · 0.36
test_slicing_only_limitFunction · 0.36
test_limit_offset_valuesFunction · 0.36
test_in_bulkFunction · 0.36
test_deleteFunction · 0.36