Merge branch 'master' of github.com:1602/jugglingdb

This commit is contained in:
Anatoliy Chakkaev 2011-10-10 17:27:22 +04:00
commit c282cc4a13
1 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,9 @@
## About
JugglingDB -- cross-db ORM, providing **common interface** to access most popular database formats. Currently supported: mysql, mongodb, redis, neo4j and js-memory-storage (yep, self-written engine for test-usage only). You can add your favorite database adapter, checkout one of existing adapters to learn how, it's super-easy, I guarantee.
JugglingDB is cross-db ORM, providing **common interface** to access most popular database formats.
Currently supported are: mysql, mongodb, redis, neo4j and js-memory-storage (yep,
self-written engine for test-usage only). You can add your favorite database adapter, checkout one of the
existing adapters to learn how, it's super-easy, I guarantee.
## Installation
@ -18,9 +21,10 @@ var Post = schema.define('Post', {
date: { type: Date, detault: Date.now },
published: { type: Boolean, default: false }
});
// simplier way to describe model
var User = schema.define('User', {
name: String,
bio: Text,
bio: Schema.Text,
approved: Boolean,
joinedAt: Date,
age: Number
@ -78,7 +82,7 @@ Read the tests for usage examples: ./test/common_test.js
## Your own database adapter
To use custom adapter, pass it package name as first argument to Schema constructor:
To use custom adapter, pass it's package name as first argument to `Schema` constructor:
mySchema = new Schema('couch-db-adapter', {host:.., port:...});
@ -88,11 +92,12 @@ Make sure, your adapter can be required (just put it into ./node_modules):
## Running tests
All tests written using nodeunit:
All tests are written using nodeunit:
nodeunit test/common_test.js
If you run this line, of course it will fall, because it requres different databases to be up and running, but you can use js-memory-engine out of box! Specify ONLY env var:
If you run this line, of course it will fall, because it requres different databases to be up and running,
but you can use js-memory-engine out of box! Specify ONLY env var:
ONLY=memory nodeunit test/common_test.js
@ -102,13 +107,17 @@ of course, if you have redis running, you can run
## Package structure
Now all common logic desribed in ./index.js, and database-specific stuff in ./lib/*.js. It super-tiny, yep?
Now all common logic described in ./index.js, and database-specific stuff in ./lib/*.js. It's super-tiny, right?
## Project status
This project written in one weekend (1,2 oct 2011), and of course it not pretend to be preduction-ready, but I plan to use this project as default ORM for RailwayJS in nearest future. So, if you familiar with some database engines - please help me to improve adapter for that database.
This project was written in one weekend (1,2 oct 2011), and of course does not claim to be production-ready,
but I plan to use this project as default ORM for RailwayJS in nearest future.
So, if you are familiar with some database engines - please help me to improve adapter for that database.
For example, I know, mysql implementation sucks now, 'cause I'm not digging too deep into SequelizeJS code, and I think would be better to replace sequelize with something low-level in nearest future, such as `mysql` package from npm.
For example, I know, mysql implementation sucks now, 'cause I'm not digging too deep into SequelizeJS code,
and I think it would be better to replace sequelize with something low-level in nearest future, such
as `mysql` package from npm.
## Contributing
@ -118,6 +127,7 @@ If you have found a bug please write unit test, and make sure all other tests st
### Common:
+ transparent interface to APIs
+ validations
+ -before and -after hooks on save, update, destroy
+ default values