We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(9)
刚刚偶然发现了这个问题;对于后代,CouchDB 和 CouchBase 是为此设计的:
http://couchdb.apache.org/
JavaScript 客户端:
https://pouchdb.com/
和 CouchBase:
https://www.couchbase.com/
最后,CouchBase Lite/Mobile:
https://www.couchbase.com/products/lite
后者让您获得本机 CouchDB/CouchBase 同步。
在所有情况下,您只需访问本地数据库,如果您连接到互联网,它就可以同步。
Just stumbled across this question; for posterity, CouchDB and CouchBase are designed for this:
http://couchdb.apache.org/
The JavaScript client:
https://pouchdb.com/
And CouchBase:
https://www.couchbase.com/
Finally, CouchBase Lite/Mobile:
https://www.couchbase.com/products/lite
The latter gets you native CouchDB/CouchBase synchronization.
In all cases you just access the local database and it can synchronize if and when you connect to the internet.
Store.js 很好地处理客户端存储。请注意,它支持 IE6+ 以及其他浏览器。对于服务器端存储,您也可以为此编写自己的脚本,因为它应该不难。
Store.js deal with the client-side storage very well. Note that it supports IE6+ along with other browsers. For the server-side storage you might as well make your own script for that as it should not be difficult.
自从提出这个问题以来,我们在本地存储和客户端数据库方面做了很多工作。
深入了解 HTML5 对本地存储选项进行了精彩概述。
还有几个可用的跨平台 JavaScript 存储库,包括 Lawnchair 和 persistence.js。
Since this question was asked, there's been a lot of work done on local storage and client side databases.
There's a great overview of local storage options at Dive Into HTML5.
There are also several cross-platform JavaScript storage libraries available, including Lawnchair and persistence.js.
我不是100%确定,但我认为不存在这样的框架。我建议您查看 Google Gears。
Google Gears 支持客户端离线存储。
另一种方法是查看 TidlyWiki 的源代码。他们创建了一个 wiki 系统,将所有数据存储在客户端。
Iam not 100% sure, but i think there isnt such a framework. I would recommend to have a look on Google Gears.
Google Gears supports offline storage on client side.
Another approach would be to check out the sourcecode of TidlyWiki. They have created an wiki system wich stores all data on client side.
我不知道现在有哪个图书馆这样做。即使这是一个可能的想法,我必须说我不确定制作这样的库是否是一项好的努力。
它必须提供如何向库公开服务器数据、如何计算增量等等的示例。这将迫使开发人员根据库的协议更改此服务器端代码。
这对于新的应用程序和网站来说可能很棒,但是对于具有特定数据结构的任何现有网站来说可能会很痛苦,因此实现这一点的努力并不比开发自己的 Javascript 来使用已经公开的当前数据来实现这一点更好。该应用程序。
除了潜在的安全问题之外,所有这些都很难在一个通用的 JavaScript 库中进行管理。
恕我直言,为特定的基于 ORM 的 MVC 框架(例如 Ruby on Rails 或 Django)制作捆绑包或插件是一个好主意。由于框架本身对数据结构进行了抽象,并且许多安全修复程序已经捆绑在一起,因此制作一个捆绑包来实现这一点将更加可重用并且更加优雅。
I'm not aware of any library that does that nowadays. Even tough this is a possible idea, I must say that I'm not sure if making such library is a good effort.
It would have to provide examples of how to expose your server data to the library, how to calculate deltas, and so on. This would force the developer to change this server side code accordingly to the library's protocol.
This could be great for new apps and websites, but this could be a pain to any existing site, with particular data structure, making the effort to implement this not so much preferable to developing your own Javascript to do that with current data already exposed by the app.
All of these on top of potential security problems would be kinda hard to manage in one generic javascript library.
IMHO this is a great idea to make bundles or plugins to specific ORM based MVC frameworks, for example Ruby on Rails or Django. Since the framework itself has an abstraction to the data structure and many security fixes already bundled together, making a bundle to do that would be much more re-usable and more elegant.
我一直在这方面做一些工作。使用 Google 文档似乎几乎是可能的。大多数 API 都可以通过 Javascript 访问。不幸的是,例外情况包括上传和下载等内容,因此虽然可以从浏览器内部枚举文档、创建文件、更改元数据等,但实际上获取数据要困难得多。
Google 电子表格确实具有用于访问各个单元格的 Javascript API,因此理论上可以将数据存储在电子表格中。不幸的是,API 中还有另一个整体,似乎很难将数据写入以前没有数据的单元格,这意味着一旦创建了空电子表格,就无法填充它......
I've been doing some work on this. It seems to be almost possible using Google Documents. Most of the APIs are accessible via Javascript. Unfortunately the exceptions include things like upload and download, so while it's possible to enumerate documents, create files, change metadata etc all from inside the browser, actually getting at the data is a lot harder.
Google Spreadsheets do have Javascript APIs for accessing individual cells, so it's theoretically possible to store your data in a spreadsheet. Unfortunately there's another whole in the API where it seems to be rather hard to write data to a cell that previously did not have data in it, which means that once you've created your empty spreadsheet, you can't populate it...
据我所知Safari、Chrome和Opera都是基于SQLite的。
SQLite 有一个 .dump 命令,它不仅可以很好地恢复数据库,而且可以与另一个数据库同步。
因此,可以使用 .dump 从 Javascript 数据库调用它,并且如有必要,修改转储并将其上传到服务器数据库以执行。
但是,您需要小心 SQL 注入尝试。
As far as I know Safari, Chrome, and Opera all based on SQLite.
SQLite has a .dump command which is not only great to restore a database but to sync with another database.
Therefore, it may be possible to call this from the Javascript Database using .dump, and if necessary, modify the dump and upload it to the server database to execute.
However, you will want to be careful of SQL injection attempts.
您尝试过 jsonengine 吗?
不确定这个项目还有多少活力,但这满足了您的所有要求。
Did you try jsonengine?
Not sure how much this project is alive but this answers all yor requirments.
Firebase 就是这样做的,尽管它不是关系模型
Firebase does this, although it is not a relational model