Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[![Build Status](https://secure.travis-ci.org/didit-tech/FastLegS.png)](http://travis-ci.org/didit-tech/FastLegS)
#FastLegS
# FastLegS

PostgreSQL ORM on top of node-postgres.

##Installation
## Installation

npm install FastLegS

##Quickstart
## Quickstart

**NOTE:** As of version```0.2.0```, both PostgreSQL and MySQL are supported.
You indicate which database you are using at object instantiation time. All
Expand Down Expand Up @@ -73,7 +73,7 @@ other operations and interfaces behave the same as older versions.
}
);

#The Full Monty
# The Full Monty

The following examples use these database tables as examples:

Expand Down Expand Up @@ -130,7 +130,7 @@ Given this setup:

The following are examples of basic CRUD operations:

##Create
## Create

Calls to ```create``` can take an object or an array of objects.

Expand Down Expand Up @@ -172,12 +172,12 @@ In the case of MySQL, the ```results``` will be an object of the form:
message: ''
}

##Read
## Read

The various forms of the ```find``` command are very flexible. We'll present a
few of them here.

####All:
#### All:

Post.find({}, callback)

Expand Down Expand Up @@ -215,7 +215,7 @@ outputs:
updated_at: null }
]

####By primary key:
#### By primary key:

Post.find(6, callback)

Expand All @@ -231,48 +231,48 @@ outputs:
updated_at: null
}

####Only show some fields:
#### Only show some fields:

Post.find(6, {only: ['id','title']}, callback)

outputs:

{ id: 6, title: 'Some Title 6' }

####Some clauses:
#### Some clauses:

Post.find({'title.like': 'Some%'}, callback)
Post.find({'id.in': [6, 7]}, callback)
Post.find({'id.nin': [6]}, callback)
Post.find({'$or': {'id.equals': 5, 'body.like': '%body 7'}}, callback)

####Order, offset, limit
#### Order, offset, limit

Post.find({}, { order: ['-id'] }, callback)
Post.find({}, { offset: 1, limit: 1 }, callback)

####Count:
#### Count:

Post.find({}, {count: true}, callback)

outputs:

{ count: 7 }

##Update
## Update

Post.update(
{ title: 'Some Title 6' },
{ title: 'Renamed title' },
callback
)

##Delete
## Delete

Post.destroy({ 'id.in': [5, 7]}, callback)
Post.truncate(callback)

##A Taste of Relationships
## A Taste of Relationships

You can call out relationships when you extend FastLegS.Base:

Expand Down Expand Up @@ -411,12 +411,12 @@ outputs:

This shows that ```professor``` Irene has ```students``` Ben and Christine

##Summary
## Summary

The tests are an excellent reference for the various modifiers and syntactic
sugar you can use in FastLegS.

##ToDo
## ToDo

Right now, the codebase is split because of syntactic differences between
PostgreSQL and MySQL. There is a lot of duplicated code, however. Future
Expand All @@ -425,7 +425,7 @@ versions should abstract out the differences and merge the duplicated code.
Watch for updates to examples in the near future to show features like
relationships and advanced queries.

#Contributors
# Contributors

* Micah Silverman ([dogeared](https://github.com/dogeared))
* Thad Clay ([thadclay](https://github.com/thadclay))
Expand Down