Shelve 是一个超简单的 No-SQL 持久层,它允许您简单地保存对象的映射。它是 Python 中常用的包,因为它允许您轻松地向任何应用程序添加持久性。
它的简单性意味着它有一定的局限性 - 但它却非常有用。您可以将任意可散列键映射到任何可序列化对象上。
Android 上有类似的东西吗?我正在编写一个非常简单的应用程序,我注意到我花了很多时间研究表格结构、选择和选择。插入语句。这是我在 Python 中几乎从未做过的事情,因为我通常有某种 NoSQL 替代方案。
我并不期望以完全相同的方式工作 - 显然 Python 和 Java 是具有非常不同特征的语言。我只是想要一些使用起来几乎同样简单并且需要更少的手动 SQL 操作的东西。
还有一件事 - 这是一个相当简单的应用程序。我更愿意引入最少的额外项目依赖项。将优先考虑只需要 Android API 的解决方案。
Shelve is an ultra-simple No-SQL persistence layer which allows you to trivially persist a mapping of objects. It's a commonly used package in Python because it allows you to trivially add persistence to any application.
It's simplistic nature means it's somewhat limited - but it's surprisingly useful. You can map any arbitrary hashable key onto any serializable object.
Does something like this exist for Android? I'm writing a very simple app, and I've noticed that I'm spending a lot of time faffing around with table structures, select & insert statements. That's the sort of thing I almost never do in Python since I'd usually have some kind of NoSQL alternative.
I'm not expecting to to work exactly the same way - clearly Python and Java are languages with very different characteristics. I just want something that nearly as simple to use and requires less manual SQL faffing.
One more thing - this is a fairly trivial app. I'd prefer to introduce the bare minimum of additional project dependencies. Preference will be given to solutions which require nothing more than the Android APIs.
发布评论
评论(2)
你说优先选择 Java API 答案,所以我可能不会优先,但 Couchbase Mobile 是我遇到过的最好的 Android No-SQL。
http://www.couchbase.org/get/couchbase-mobile-for -android/当前
You said preference to Java API answers so I probably won't get preference, but Couchbase Mobile is the best Android No-SQL I have ever come across.
http://www.couchbase.org/get/couchbase-mobile-for-android/current
您可以使用 SharedPrefences .android.com/guide/topics/data/data-storage.html" rel="nofollow">数据存储。这几乎就是你所需要的。为此,您不需要完整的 SQLite 功能。
You can use SharedPrefences from DataStore. It's pretty much what you need. You don't need full SQLite power for this.