JavaScript 的 Database 是 一個很酷的 Idea, 但是, 好像又有點怪怪的.....
DB 的空間只有 10K, 這跟直接存在 Cookie 或存成 JS Array 比起來, 似乎沒有比較方便.
不過, 提供的 DB 處理倒是可以省掉不少工(ex: Find / Update / Insert / Remove / OrderBy ... 等). 先記起來, 之後再研究如何應用它~ 🙂
JavaScript Database: Taffy DB : A JavaScript database for your browser
此 Taffy DB Library 的功能/限制
- 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 Queries
Taffy DB 的 CRUD
- Insert: friends.insert({name:"Brian", gender:"M", married:"No", age:52, state:"FL", favorite_foods:["fruit","steak"]});
- Select: friends.find({state:["WA","MT","ID"], age:{less:50}}, [0,2]);
- Update: friends.update({state:"CA", married:"Yes"}, {name:"Joyce"});
- Delete: friends.remove({name:"Brian"});
- OrderBy: friends.orderBy(["age", {"name":"asce"}]);
- 詳細用法可見: Getting Started: Your first bite of Taffy