https://github.com/toddself/parthenon
A column-minimal experimental ORM for Postgres
https://github.com/toddself/parthenon
Last synced: 3 months ago
JSON representation
A column-minimal experimental ORM for Postgres
- Host: GitHub
- URL: https://github.com/toddself/parthenon
- Owner: toddself
- Created: 2018-11-18T20:16:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-09T21:25:06.000Z (over 7 years ago)
- Last Synced: 2026-03-25T19:50:47.202Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# parthenon
An experimental ORM using JSONB column types in Postgres
## Usage
```js
const ORM = require('./orm')
const orm = new ORM({database: 'test'})
const UserModel = orm.makeModel({
name: 'user',
table: 'users',
fields: {
name: orm.fields.string(),
group: orm.fields.related('group', 'members')
}
})
const GroupModel = orm.makeModel({
name: 'group',
fields: {
name: orm.fields.string(),
user: orm.fields.related(UserModel, 'members')
}
})
await orm.initialize([UserModel])
const group = new GroupModel({name: 'people'})
const user = new UserModel({name: 'todd', group})
await user.save()
await orm.end()
```
## License
Copyright © 2018 Todd Kennedy, Apache-2.0 licensed