public interface JpaTagRepository
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SELECT_FOR_UPDATE_UNUSED_TAGS_SQL
This is the query used to find the ids of tags that aren't referenced by any of the other tables.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
deleteByIdIn(java.util.Set<java.lang.Long> ids)
Delete all tags from the database whose ids are in the supplied set.
|
boolean |
existsByTag(java.lang.String tag)
Find out whether a tag entity with the given tag value exists.
|
java.util.Optional<TagEntity> |
findByTag(java.lang.String tag)
Find a tag by its unique tag value.
|
java.util.Set<TagEntity> |
findByTagIn(java.util.Set<java.lang.String> tags)
Find tag entities where the tag value is in the given set of tags.
|
java.util.Set<java.lang.Number> |
findUnusedTags(java.time.Instant createdThreshold)
Find all tags from the database that aren't referenced which were created before the supplied created
threshold.
|
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlush
findAll
count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save
static final java.lang.String SELECT_FOR_UPDATE_UNUSED_TAGS_SQL
java.util.Optional<TagEntity> findByTag(java.lang.String tag)
tag
- The tag value to search forboolean existsByTag(java.lang.String tag)
tag
- The tag value to check forjava.util.Set<TagEntity> findByTagIn(java.util.Set<java.lang.String> tags)
tags
- The tags to find entities for@Query(value="SELECT id FROM tags WHERE id NOT IN (SELECT DISTINCT(tag_id) FROM applications_tags) AND id NOT IN (SELECT DISTINCT(tag_id) FROM clusters_tags) AND id NOT IN (SELECT DISTINCT(tag_id) FROM commands_tags) AND id NOT IN (SELECT DISTINCT(tag_id) FROM criteria_tags) AND id NOT IN (SELECT DISTINCT(tag_id) FROM jobs_tags) AND created <= :createdThreshold FOR UPDATE;", nativeQuery=true) java.util.Set<java.lang.Number> findUnusedTags(@Param(value="createdThreshold") java.time.Instant createdThreshold)
createdThreshold
- The instant in time where tags created before this time that aren't referenced
will be returned. Inclusive@Modifying java.lang.Long deleteByIdIn(java.util.Set<java.lang.Long> ids)
ids
- The ids of the tags to delete