A JavaScript database
from: http://taffydb.com/
Taffy DB : A JavaScript database for your browser
Taffy DB is a free and opensource JavaScript library that acts as thin data layer inside Web 2.0 and Ajax applications.
What makes it cool:
※Under 10K!
※Simple, JavaScript Centric Syntax
※Fast
※Easy to include in any web application
※Compatible with major Ajax libraries: YUI, JQuery, Dojo, Prototype, EXT, etc
※CRUD Interface (Create, Read, Update, Delete)
※Sorting
※Looping
※Advanced QueriesThink of it as a SQL database in your web browser.
坦白说,如果页面切换就清空数据库内容的话,实在想不出来这个东西有什么好处。也许只能做成gmail那样的,但是gmail那样的东西需要一个javascript database么?
例子:
Creating Collections:
var friends = new TAFFY({name:"Brian", gender:"M", married:"No", age:52, state:"FL", favorite_foods:["fruit","steak"]});Insert:
friends.insert({name:"Joyce", ender:"F", married:"No", age:29, state:"WA", favorite_foods:["salad","cheese sticks"]});Find:
friends.find({age:{greaterthan:22}});Update:
friends.update({state:"CA",married:"Yes"},{name:"Joyce"});Remove:
friends.remove({name:"Brian"});OrderBy:
friends.orderBy(["age",{"name":"asce"}]);ForEach:
friends.forEach(function (f) {alert(f.name);},{favorite_foods:{arraycontains:"pizza"}});Get / First:
friends.get({name:"Joyce"});Advanced Queries:
friends.find({state:["WA","MT","ID"], age:{less:50}}, [0,2]);
其实用来做Rich Web Application不错,把要展现的内容先load到javascript数据库中,然后排序啊啥的,还是比较方便。
可以做很rich的,不过我觉得独立于服务器的话用处还是不大。
JSON 是个很可爱的东西~
其实这个“数据库”的理念挺不错的,许多 web app 压根不需要那么庞大的关系数据库。
“文档型数据库”是目前的一个尝试方向,比如 CouchDb。
我一直不知道这里的
“继续阅读全文... ”
是怎么设置的
吴雨、天魔给诠释一下
看ubb标签使用说明吧,more