-
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.
[maro/#33] feat :: SongDao, SongDatabase 추가
- Loading branch information
1 parent
b7fa9e7
commit bb3935b
Showing
4 changed files
with
72 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.example.umc_6th | ||
|
||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
import androidx.room.Update | ||
|
||
interface SongDao { | ||
@Insert | ||
fun insert(song: Song) | ||
|
||
@Update | ||
fun update(song: Song) | ||
|
||
@Delete | ||
fun delete(song : Song) | ||
|
||
@Query("SELECT * FROM SongTable") | ||
fun getSongs() : List<Song> | ||
|
||
@Query("SELECT * FROM SongTable WHERE id = :id") | ||
fun getSong(id : Int): Song | ||
} |
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,10 +1,18 @@ | ||
package com.example.umc_6th | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "SongTable") | ||
data class Song( | ||
val title : String = "", | ||
val singer : String = "", | ||
var second : Int = 0, | ||
var playTime : Int = 60, | ||
var isPlaying : Boolean = false, | ||
var music : String = "" | ||
) | ||
var music : String = "", | ||
var coverImg : Int? = null, | ||
var isLike : Boolean = false | ||
){ | ||
@PrimaryKey(autoGenerate = true) var id : Int = 0 | ||
} |