显然,这取决于考虑选项的业务规则。所以不会有“正确”的答案。
至少我们的一名团队成员是按照这些思路进行思考的。这是我们的解决方案:
在 SQLite 本地处理所有事务数据,因为我们不需要跨设备进行事务。
使用 Firebase 同步其余部分。
(1) 确保我们不会滥用 Firebase 对其客户端的非持久离线可用性。
The docs
Even with persistence enabled, transactions are not persisted across app restarts. So you cannot rely on transactions done offline being committed to your Firebase Realtime Database. To provide the best user experience, your app should show that a transaction has not been saved into your Firebase Realtime Database yet, or make sure your app remembers them manually and executes them again after an app restart.
(2) 确保我们使用 Firebase 的持久离线特性在连接(重新)建立后跨设备同步非事务性数据。
The docs, The Firebase Realtime Database client automatically keeps a queue of all write operations that are performed while your app is offline. When persistence is enabled, this queue is also persisted to disk so all of your writes are available when the user or operating system restarts the app. When the app regains connectivity, all of the operations are sent to the Firebase Realtime Database server.
通过这种方式,我们实现了我们使用中可接受的状态。
“它是否可以像 SQLite 那样容纳尽可能多的数据,并且查询功能是否强大?” no 和 no if strong 被翻译为“transaction 跨设备”,根据 Firebase 的定义是一个远程数据库。