Taffy DB : A JavaScript database for your browser

[from http://blog.joesgoals.com/]

I’d like to take a moment to introduce something I’ve been working on a while: TaffyDB.

TaffyDB is a free (opensource) JavaScript database for Ajax applications. It works by creating a thin (under 10K) data layer within your application. You can insert, update, delete, order, loop, and query against the data layer and integrate it with just about any JavaScript framework such as YUI and JQuery.

The idea came to me as I was working on Joe’s Goals 2.0 and I realized that one of the hardest parts about building any Web 2.0 application is working with data. There is no good way to use JavaScript by itself to gather, search, and maintain a collection of data. There are lots of great ways to great interfaces now days, but what about the data behind them? TaffyDB is the result of the research and testing I did for Joe’s Goals and is now avaliable for everyone to use.

TaffyDB is not a visual library. You’ll still need to code the user interface. TaffyDB reduces acres of custom JavaScript data handling code to single line commands, giving you more time to work on interface.

Examples:

  • Create a contact collection:

var contacts = new TAFFY([]);

  • Add a contact:

contacts.insert({id:1,first_name:”John”,last_name:”Smith”,age:29});

  • Find contacts with a last name of Smith than are older than 22:

contact.find({last_name:”Smith”,age:{greaterthan:22}});

  • Order contacts by last name and then first name:

contacts.orderBy([”last_name”,”first_name”]);

You can also update, delete, loop, and much more. To learn how check out the Getting Started article. I’d also be delighted to hear any feedback or bug reports you have. Please submit them here.

你可能感兴趣的:(JavaScript)