mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-19 10:00:16 +01:00
Created NoteTypeConverter
This commit is contained in:
parent
e8b8d2be1d
commit
0112f39ff0
@ -17,6 +17,7 @@ import java.io.File
|
|||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
@Entity(tableName = "notes", indices = [(Index(value = ["id"], unique = true))])
|
@Entity(tableName = "notes", indices = [(Index(value = ["id"], unique = true))])
|
||||||
|
@TypeConverters(NoteTypeConverter::class)
|
||||||
data class Note(
|
data class Note(
|
||||||
@PrimaryKey(autoGenerate = true) var id: Long?,
|
@PrimaryKey(autoGenerate = true) var id: Long?,
|
||||||
@ColumnInfo(name = "title") var title: String,
|
@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