ios - Realm 查询如何工作?

标签 ios swift realm

我正在尝试了解 Realm。

https://academy.realm.io/posts/jp-simard-realm-core-database-engine/

enter image description here

我试图理解说话者的意思 我们本质上是在构建一棵树,结果应该是什么样子

我认为他的意思是 Realm 将读取具有 name 和 fulltime 属性的所有对象,但不会读取任何其他属性,然后检查 name 为 Jack 和 fulltime 是否为 true。 Realm 是否遍历所有对象?

最佳答案

I think he meant that the Realm will read all objects with name and fulltime properties but not any other properties and then checks if the name is Jack and fulltime is true.

不完全是。 Realm 仅获取符合过滤器查询的对象。

Is realm iterating through all objects?

您可以阅读 Realm docs关于以下查询:

All queries (including queries and property access) are lazy in Realm. Data is only read when the properties are accessed.

所以,Realm仅返回(我相信)Results<Employee>包含过滤的对象,但技术上从 realm-db 读取它们仅在您尝试访问它们的那一刻。

关于ios - Realm 查询如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45811595/

相关文章:

ios - 如何在 iOS swift 中添加 LinkedIn OAuth 2.0 身份验证?

具有动态高度单元格的 iOS 表格 View ,但所有单元格都同时显示

ios - 覆盖协议(protocol)泛型方法

java - 在 Android 上共享 Realm 字段

每次用户进入后台至少 30 秒时,在 iOS 13 上运行的 iOS 应用程序都会重置

ios - 在我的 iPad 上打开下载的应用程序的 Swift 程序

ios - 在加载ECSlidingViewController之前设置topViewController

ios - 重命名 xcode 项目

ios - 如何同时写入Realm的不同对象?

ios - 删除特定对象 Realm Swift