Skip to content

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

Notifications You must be signed in to change notification settings

chrisdickinson/ormnomnom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f791007 · Apr 21, 2022
Jun 5, 2020
Apr 20, 2022
Dec 8, 2020
Oct 3, 2019
Mar 17, 2022
Apr 20, 2022
Jan 2, 2018
Jul 11, 2018
Jul 11, 2018
Apr 14, 2017
Oct 3, 2019
Apr 21, 2022
Apr 21, 2022

Repository files navigation

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: { 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

License

MIT

About

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

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published