Skip to content

Commit

Permalink
Add delete functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskioko committed May 15, 2023
1 parent b333b55 commit a93963b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ VALUES(?,?,?,?,?,?,?);
selectByShowId:
SELECT *
FROM trailers
WHERE trakt_id = ?;
WHERE trakt_id = ?;

delete:
DELETE FROM trailers WHERE trakt_id = ?;

deleteAll:
DELETE FROM trailers;
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ interface TrailerDao {
fun insert(trailerList: List<Trailers>)

fun observeTrailersById(showId: Long): Flow<List<Trailers>>

fun delete(id: Long)

fun deleteAll()
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,16 @@ class TrailerDaoImpl(
.asFlow()
.mapToList(dispatchers.io)
}

override fun delete(id: Long) {
database.transaction {
database.trailersQueries.delete(id)
}
}

override fun deleteAll() {
database.transaction {
database.trailersQueries.deleteAll()
}
}
}

0 comments on commit a93963b

Please sign in to comment.