gpt4 book ai didi

android - 深层嵌套对象的 Realm 查询对象

转载 作者:行者123 更新时间:2023-11-29 23:42:40 26 4
gpt4 key购买 nike

我打算使用 Realm 数据库,我有一个类似这样的结构:

A类:
-id
-B对象列表

B级:
-id
-C对象

C类:
-id

是否可以在 Realm 内根据 C.id 查询 A ?谢谢!

最佳答案

Is it possible in realm to query A based on C.id ?

答案是“有点”。您可以检查是否有至少有 1 个 B 的 A,其中至少有 1 个 C 是“某物”。

Can I check if there are any As that have any Bs where at least one of Cs has an id of something?

它是 realm.where(A.class).equalTo("bs.c.id", "idOfC").findAll()

Realm 的 Java API 中的链接查询转换为 ANY,我喜欢将其视为“至少有一个位置”。

关于android - 深层嵌套对象的 Realm 查询对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51736983/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com