save-usergrid
Usergrid engine for save crud operations
Last updated 3 years ago by confuser .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install save-usergrid 
SYNC missed versions from official npm registry.

save-usergrid

Build Status

Usergrid persistance engine for save

Installation

npm install save-usergrid

Usage

var save = require('save') // npm install save
  , usergrid = require('save-usergrid')
  , collection = 'contacts'
  , auth =
    { host: 'https://localhost'
    , org: 'org'
    , app: 'app'
    , grantType: 'client_credentials'
    , clientId: 'client'
    , clientSecret: 'such secret, much wow'
    }

// Create a save instance and pass in a Usergrid engine.
var contactStore = save('Contact', { engine: usergrid(collection, auth) })

// Then we can create a new entity.
contactStore.create({ name: 'James', email: 'jamesmortemore@gmail.com'}, function (error, contact) {

  // The created 'contact' is returned and has been given a uuid
  console.log(contact)
})

// Lets find that entity with a query
contactStore.findOne('SELECT * WHERE name = James', function (error, contact) {
  // Will be the entity created above
  console.log(contact)
})

// Lets update the entity
contactStore.read('1234-1234-1234-1235', function (error, contact) {
  contact.name = 'Jamez'

  contactStore.update(contact, function (error, updatedContact) {
    console.log(updatedContact)
  })
})

// Lets delete the entity
contactStore.delete('1234-1234-1234-1235', function (error, contact) {
  // Entire entity that was deleted
  console.log(contact)
})

Current Tags

  • 1.4.1                                ...           latest (3 years ago)

10 Versions

  • 1.4.1                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |