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

Method first

tortoise/models.py:1489–1493  ·  view source on GitHub ↗

Generates a QuerySet that returns the first record.

(cls, using_db: BaseDBAsyncClient | None = None)

Source from the content-addressed store, hash-verified

1487
1488 @classmethod
1489 def first(cls, using_db: BaseDBAsyncClient | None = None) -> QuerySetSingle[Self | None]:
1490 """
1491 Generates a QuerySet that returns the first record.
1492 """
1493 return cls._db_queryset(using_db).first()
1494
1495 @classmethod
1496 def last(cls, using_db: BaseDBAsyncClient | None = None) -> QuerySetSingle[Self | None]:

Callers 15

_fk_getterFunction · 0.45
_ro2o_getterFunction · 0.45
test_defaultFunction · 0.45
test_updateFunction · 0.45
test_update_relationFunction · 0.45
test_basicFunction · 0.45
test_char_fuzzFunction · 0.45
test_uuid_pk_fkMethod · 0.45
test_char_pk_fkMethod · 0.45
test_only_straight_firstFunction · 0.45
test_only_source_firstFunction · 0.45

Calls 1

_db_querysetMethod · 0.80

Tested by 15

test_defaultFunction · 0.36
test_updateFunction · 0.36
test_update_relationFunction · 0.36
test_basicFunction · 0.36
test_char_fuzzFunction · 0.36
test_uuid_pk_fkMethod · 0.36
test_char_pk_fkMethod · 0.36
test_only_straight_firstFunction · 0.36
test_only_source_firstFunction · 0.36