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 int
countOlderThanOrEqual(long submissionTimestamp)
Counts all entries that have a submission timestamp less or equal than the specified one.void
deleteOlderThanOrEqual(long submissionTimestamp)
Deletes all entries that have a submission timestamp less or equal than the specified one.void
saveDoNothingOnConflict(byte[] keyData, int rollingStartIntervalNumber, int rollingPeriod, long submissionTimestamp, int transmissionRisk)
Attempts to write the specified diagnosis key information into the database.
-
-
-
Method Detail
-
countOlderThanOrEqual
@Query("SELECT COUNT(*) FROM diagnosis_key WHERE submission_timestamp<=:threshold") int countOlderThanOrEqual(@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.
-
deleteOlderThanOrEqual
@Modifying @Query("DELETE FROM diagnosis_key WHERE submission_timestamp<=:threshold") void deleteOlderThanOrEqual(@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") void 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.
-
-