objectbox / objectbox/objectbox-java
Store Map values as Long instead of Int
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 4.6k
- 派生
- 311
- PR 合并指标
- 30 天内没有已合并 PR
描述
Is there an existing issue?
- I have searched existing issues
Use case
I am storing a mapping:
val mapping = mutableMapOf(
"key1" to mutableMapOf(
"subkey1" to 1L,
"subkey2" to 1L,
"subkey3" to 1L
),
"key2" to 1L
that is represented in the data class as follows:
@Entity
data class MyDataClass(
@Id var id: Long = 0,
var mapping: MutableMap<String, Any>? = null
ObjectBox will store the Long values as Ints due to not being wide enough. These breaks use cases where we do want to store the Long values as Long and not as Ints (for example test cases that use the same generated mock data to store in the database and to test against).
Proposed solution
Have an annotation that tells ObjectBox to store Long values as Long.
Alternatives
Tried using a PropertyConverter however this breaks for the mapping I've provided.
Additional context
Kotlin
Android
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 没有指明文件或测试。首先跟踪 MutableMap<String, Any> 值是如何序列化的,以及尝试使用的 PropertyConverter 为何无法用于此映射;然后确定提议的 annotation 应如何保留 Long 值,并验证存储和取回的值仍然是 Long。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, java, kotlin
- 领域
- database, mobile
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100