Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chrisdickinson/ormnomnom

an orm that does 80% of the work and gets out of the way for the remaining 20%
https://github.com/chrisdickinson/ormnomnom

Last synced: 20 days ago
JSON representation

an orm that does 80% of the work and gets out of the way for the remaining 20%

Awesome Lists containing this project

README

        

# ormnomnom

ORMnomnom is yet another Node ORM. It is specifically for use with postgres
(via [pg](http://npm.im/pg)), exposes single-async-events as
[bluebird](http://npm.im/bluebird) promises, and exposes async-iterables as
[streams](http://nodejs.org/api/stream.html). It requires a modern version of
Node (v4+).

```javascript
const orm = require('ormnomnom')

class Package {
constructor (opts) {
Object.assign(this, opts)
}
}

class Author {
constructor (opts) {
Object.assign(this, opts)
}
}

const PackageObjects = orm(Package, {
id: { type: 'integer' },
name: { type: 'string', pattern: '^[a-z0-9]$'},
author: orm.fk(Author)
})

const AuthorObjects = orm(Author, {
id: { type: 'integer' },
name: { type: 'string', pattern: '^[a-z0-9]$'},
email: { type: 'string', format: 'email'}
})

PackageObjects.filter({'author.name:startsWith': 'Gary'}).then(objects => {
// list of objects
})
```

## Documentation

* **Introduction**
* [Getting Started with ORMnomnom](docs/getting-started.md)
* [Building models](docs/building-models.md)
* [Making queries](docs/making-queries.md)
* [Decorators](docs/decorators.md)
* **Reference documentation**
* [Data access objects](docs/ref/dao.md)
* [QuerySets](docs/ref/queryset.md)
* [Clauses](docs/ref/queryset.md#clauses)

## License

MIT