Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Indroic/HexCore/llms.txt
Use this file to discover all available pages before exploring further.
IBaseRepository is the abstract contract every repository adapter must implement. It is generic over T (any BaseEntity subclass), so a concrete SQLAlchemyUserRepository can declare IBaseRepository[User] and the entire CRUD surface becomes type-safe. The interface ships with one concrete helper method, get_active_by_id, that adds a soft-delete guard on top of the abstract get_by_id without requiring you to duplicate that logic in every adapter.
Class definition
Class attribute
Signals to callers (and documentation) that this repository implementation honours the
limit / offset parameters of list_all. Override to False in adapters that use cursor-based pagination or return full result sets.Constructor
The Unit of Work instance this repository belongs to. Stored on
self.uow and used to participate in the same transactional boundary as other repositories registered with the same UoW.Abstract methods
The following four methods must be implemented by every concrete repository. All are async.get_by_id
EntityNotFoundException).
The UUID primary key of the entity to retrieve.
The found entity instance, including inactive ones. Use
get_active_by_id if you need the soft-delete guard.list_all
limit_offset_pagination is True, implementations are expected to apply limit and offset to the underlying query.
Maximum number of entities to return.
None means no limit.Number of entities to skip before collecting results.
The (possibly paginated) list of entity instances.
save
updated_at).
The entity instance to create or update.
The entity as it exists in the data store after the save operation.
delete
DELETE or delegate to entity.deactivate() for logical deletion, depending on project requirements.
The entity instance to remove.
Concrete method
get_active_by_id
get_by_id and then checks entity.is_active. Raises InactiveEntityException if the entity exists but is logically deleted. This guard is pre-built so you do not need to repeat it in every adapter.
The UUID of the entity to retrieve. The entity must exist and have
is_active=True.The active entity instance.
InactiveEntityException — if entity.is_active is False.
InactiveEntityException
get_active_by_id when a requested entity is found in the data store but has been soft-deleted (is_active=False). Catch this in your application layer to return a 404 or 410 HTTP response rather than exposing inactive data.