KQLite DELETE

Quickly deleting data

// DELETE FROM Artists WHERE ArtistId = ?;
Artists.quickDelete {  it: Artists 
    it.artistId.EQ(3)
}

Delete all rows without WHERE

// DELETE FROM Artists;
Artists.quickDelete(where = null)

Delete execute

// DELETE FROM artists WHERE Name LIKE ? LIMIT ?;
Artists
    .delete()
    .where {  it: Artists 
        it.artistName LIKE "%Cool%"
    }
    .limit(2)
    .execute()

Delete RETURNING

// DELETE FROM artists WHERE ArtistId > ?
// ORDER BY ArtistId DESC LIMIT ?
// RETURNING ArtistId;
val cursor = Artists
    .delete()
    .where {  it: Artists 
        it.artistId GT 1
    }
    .orderBy(Artists.artistId, Sort.DESC)
    .limit(3)
    .executeReturning(Artists.artistId)

val deleted = cursor
    .asSequence()
    .map { it[Artists.artistId] }
    .toList()

println("Artists deleted: ${deleted.joinToString()}")
cursor.close()
⬅ KQLite UPDATE KQLite Flow ⮕