Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

ormnomnom

5.2.2 • Public • Published

ormnomnom

ORMnomnom is yet another Node ORM. It is specifically for use with postgres (via pg), exposes single-async-events as bluebird promises, and exposes async-iterables as streams. It requires a modern version of Node (v4+).

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: orm.joi.number(),
  name: orm.joi.string().lowercase().required(),
  author: orm.fk(Author)
})
 
const AuthorObjects = orm(Author, {
  id: orm.joi.number(),
  name: orm.joi.string().lowercase().required(),
  email: orm.joi.string().email().required()
})
 
PackageObjects.filter({'author.name:startsWith': 'Gary'}).then(objects => {
  // list of objects
})

Documentation

License

MIT

Keywords

install

npm i ormnomnom

Downloadsweekly downloads

64,594

version

5.2.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability