mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-19 01:50:07 +01:00
Created NoteTypeConverter
This commit is contained in:
parent
e8b8d2be1d
commit
0112f39ff0
@ -17,6 +17,7 @@ import java.io.File
|
||||
*/
|
||||
@Serializable
|
||||
@Entity(tableName = "notes", indices = [(Index(value = ["id"], unique = true))])
|
||||
@TypeConverters(NoteTypeConverter::class)
|
||||
data class Note(
|
||||
@PrimaryKey(autoGenerate = true) var id: Long?,
|
||||
@ColumnInfo(name = "title") var title: String,
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.simplemobiletools.notes.pro.models
|
||||
|
||||
import androidx.room.TypeConverter
|
||||
|
||||
class NoteTypeConverter {
|
||||
@TypeConverter
|
||||
fun fromNoteType(noteType: NoteType): Int {
|
||||
return noteType.value
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toNoteType(value: Int): NoteType {
|
||||
return NoteType.fromValue(value)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user