forked from touchlab/KaMPKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
81 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
shared/src/commonMain/kotlin/co/touchlab/kampkit/domain/breed/Breed.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package co.touchlab.kampkit.domain.breed | ||
|
||
data class Breed( | ||
val id: Long, | ||
val name: String, | ||
val favorite: Boolean | ||
) |
10 changes: 10 additions & 0 deletions
10
shared/src/commonMain/kotlin/co/touchlab/kampkit/domain/breed/BreedRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package co.touchlab.kampkit.domain.breed | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface BreedRepository { | ||
fun getBreeds(): Flow<List<Breed>> | ||
suspend fun refreshBreedsIfStale() | ||
suspend fun refreshBreeds() | ||
suspend fun updateBreedFavorite(breedId: Long) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
shared/src/commonMain/kotlin/co/touchlab/kampkit/ui/breeds/BreedsViewState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
shared/src/commonMain/sqldelight/co/touchlab/kampkit/db/Table.sq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import kotlin.Boolean; | ||
|
||
CREATE TABLE Breed ( | ||
CREATE TABLE DbBreed ( | ||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
name TEXT NOT NULL UNIQUE, | ||
favorite INTEGER AS Boolean NOT NULL DEFAULT 0 | ||
); | ||
|
||
selectAll: | ||
SELECT * FROM Breed; | ||
SELECT * FROM DbBreed; | ||
|
||
selectById: | ||
SELECT * FROM Breed WHERE id = ?; | ||
SELECT * FROM DbBreed WHERE id = ?; | ||
|
||
selectByName: | ||
SELECT * FROM Breed WHERE name = ?; | ||
SELECT * FROM DbBreed WHERE name = ?; | ||
|
||
insertBreed: | ||
INSERT OR IGNORE INTO Breed(name) | ||
INSERT OR IGNORE INTO DbBreed(name) | ||
VALUES (?); | ||
|
||
deleteAll: | ||
DELETE FROM Breed; | ||
DELETE FROM DbBreed; | ||
|
||
updateFavorite: | ||
UPDATE Breed SET favorite = ? WHERE id = ?; | ||
UPDATE DbBreed SET favorite = ? WHERE id = ?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.