Package com.helixframework.db.repository
Interface OffsetPagedRepository<T,K>
- Type Parameters:
T- the type of entity stored in the repositoryK- the type of the entity's key
public interface OffsetPagedRepository<T,K>
Represents a repository with offset-based pagination functionality.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclear()Deletes all entities from the repository.Finds an entity by its key.default OffsetPagedResult<T>Executes a query based on the given query specification.default OffsetPagedResult<T>query(QuerySpecification<T> spec) Executes a query based on the given query specification.default intremove(UpdateSpecification spec) Removes entities from the repository according to the specifications provided.default voidRemoves an entity from the repository.default intupdate(UpdateSpecification spec) Updates entities in the repository according to the specifications provided.default TUpdates an entity in the repository.
-
Method Details
-
query
Executes a query based on the given query specification.- Parameters:
spec- the query specification to execute- Returns:
- a result containing the entities that match the query and offset pagination information
-
query
Executes a query based on the given query specification.- Parameters:
spec- the query specification to execute- Returns:
- a result containing the entities that match the query and offset pagination information
-
find
Finds an entity by its key.- Parameters:
key- the key of the entity- Returns:
- an Optional containing the entity if found, or an empty Optional if not found
-
update
Updates an entity in the repository.- Parameters:
entity- the entity to be updated- Returns:
- the updated entity
-
update
Updates entities in the repository according to the specifications provided.- Parameters:
spec- the update specification that defines the conditions and parameters for the update- Returns:
- the number of rows affected by the update operation
-
remove
Removes an entity from the repository.- Parameters:
entity- the entity to be deleted
-
remove
Removes entities from the repository according to the specifications provided.- Parameters:
spec- the update specification defining the criteria for entity removal- Returns:
- the number of rows affected by the remove operation
-
clear
default void clear()Deletes all entities from the repository.
-