0.2.0 • Published 6 years ago

bookshelf-upsert v0.2.0

Weekly downloads
621
License
MIT
Repository
github
Last release
6 years ago

bookshelf-upsert

A Bookshelf plugin that adds model.upsert()

Build Status

Install

$ npm install --save bookshelf-upsert

Plugging In

const upsert = require('bookshelf-upsert')

bookshelf.plugin(upsert)

Usage

const model = require('a-bookshelf-model')

model.forge({ some: 'data' })
.where({ optional: 'constraint' })
.upsert({ optional: 'attributes' })

API

model.upsert(attributes, options)

Bookshelf model instances are provided the upsert method, which may be given attributes and options that will be passed along to model.save(). This implementation of upsert first attempts an update then if no rows are updated it follows up with an insert.

License

MIT

0.2.0

6 years ago

0.1.5

6 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago