Interface DiagnosisKeyRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<DiagnosisKey,Long>,org.springframework.data.repository.PagingAndSortingRepository<DiagnosisKey,Long>,org.springframework.data.repository.Repository<DiagnosisKey,Long>
@Repository public interface DiagnosisKeyRepository extends org.springframework.data.repository.PagingAndSortingRepository<DiagnosisKey,Long>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcountOlderThan(long submissionTimestamp)Counts all entries that have a submission timestamp less or equal than the specified one.voiddeleteOlderThan(long submissionTimestamp)Deletes all entries that have a submission timestamp less or equal than the specified one.booleansaveDoNothingOnConflict(byte[] keyData, int rollingStartIntervalNumber, int rollingPeriod, long submissionTimestamp, int transmissionRisk)Attempts to write the specified diagnosis key information into the database.
-
-
-
Method Detail
-
countOlderThan
@Query("SELECT COUNT(*) FROM diagnosis_key WHERE submission_timestamp<:threshold") int countOlderThan(@Param("threshold") long submissionTimestamp)Counts all entries that have a submission timestamp less or equal than the specified one.- Parameters:
submissionTimestamp- The submission timestamp up to which entries will be expired.- Returns:
- The number of expired keys.
-
deleteOlderThan
@Modifying @Query("DELETE FROM diagnosis_key WHERE submission_timestamp<:threshold") void deleteOlderThan(@Param("threshold") long submissionTimestamp)Deletes all entries that have a submission timestamp less or equal than the specified one.- Parameters:
submissionTimestamp- The submission timestamp up to which entries will be deleted.
-
saveDoNothingOnConflict
@Modifying @Query("INSERT INTO diagnosis_key (key_data, rolling_start_interval_number, rolling_period, submission_timestamp, transmission_risk_level) VALUES (:keyData, :rollingStartIntervalNumber, :rollingPeriod, :submissionTimestamp, :transmissionRisk) ON CONFLICT DO NOTHING") boolean saveDoNothingOnConflict(@Param("keyData") byte[] keyData, @Param("rollingStartIntervalNumber") int rollingStartIntervalNumber, @Param("rollingPeriod") int rollingPeriod, @Param("submissionTimestamp") long submissionTimestamp, @Param("transmissionRisk") int transmissionRisk)Attempts to write the specified diagnosis key information into the database. If a row with the specified key data already exists, no data is inserted.- Parameters:
keyData- The key data of the diagnosis key.rollingStartIntervalNumber- The rolling start interval number of the diagnosis key.rollingPeriod- The rolling period of the diagnosis key.submissionTimestamp- The submission timestamp of the diagnosis key.transmissionRisk- The transmission risk level of the diagnosis key.- Returns:
- true if the diagnosis key was inserted successfully, false otherwise.
-
-