Код: Выделить всё
FollowEntityType
Код: Выделить всё
@Entity(primaryKeys = arrayOf("id", "type"), tableName = "follow_info")
data class FollowInfoEntity(
@ColumnInfo(name = "id") var id: String,
@ColumnInfo(name = "type") var type: FollowEntityType,
)
Код: Выделить всё
class FollowDatabaseTypeConverter {
@TypeConverter
fun toFollowEntity(entityType: String?): FollowEntityType? {
return FollowEntityType.from(entityType ?: Constants.EMPTY_STRING)
}
@TypeConverter
fun toString(entityType: FollowEntityType?): String? {
return entityType?.name
}
}
Это запрос.
Код: Выделить всё
@Query("select * from follow_info where type in (:entityTypeList)")
fun getFollowedEntitiesByType(entityTypeList: List) : List
Код: Выделить всё
Query method parameters should either be a type that can be converted into a database column or a List / Array that contains such type. You can consider adding a Type Adapter for this.
java.util.List
Подробнее здесь: [url]https://stackoverflow.com/questions/53885749/query-method-parameters-should-either-be-a-type-that-can-be-converted-into-a-dat[/url]