0.2.1 • Published 12 years ago

activerecord v0.2.1

Weekly downloads
38
License
-
Repository
github
Last release
12 years ago

node-activerecord

An ORM written in Coffeescript that supports multiple database systems, both SQL and NoSQL, as well as ID generation middleware. It is fully extendable to add new database systems and plugins.

Note: this project is new and is not finished yet. There is still a lot of functionality to add.

Examples

Configuration

ActiveRecord = require '../src'

module.exports = new ActiveRecord.Configuration
  sqlite:
    database: "#{__dirname}/test.db"
  mysql:
    host: 'localhost'
    database: 'test'
    user: 'test'
    password: 'password'

Model Definition

ActiveRecord = require '../src'
config = require __dirname + "/config"

# Note: uses sqlite3 by default
class User extends ActiveRecord.Model
  config: config
  fields: ['id', 'username', 'name']

Creating a Record

user = new User()
user.username = "meltingice"
user.name = "Ryan"
user.save()

Retreiving a Record

User.find 1, (user) -> console.log user.toJSON()
0.2.1

12 years ago

0.2.0

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago