How to use the loopback-connector.Connector function in loopback-connector

To help you get started, we’ve selected a few loopback-connector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mgleland / loopback-connector-domino / lib / domino.js View on Github external
*/
DominoConnector.prototype.replaceById = function(model, id, data, options, callback) {
    let req = this._generateRequest();

    // TODO: The data may include an "id" property and the value may
    // be the same as the document UNID.  Should we remove "id" before
    // sending the PUT request?

    req.put({ "uri": "/documents/unid/" + id, "json": data }, (e, r, body) => {
        callback(null, body);
    });
};


var Connector = require('loopback-connector').Connector;
require('util').inherits(DominoConnector, Connector);
github guardly / loopback-connector-couchbase / lib / cb.js View on Github external
/**
 * @constructor
 * Constructor for Couchbase connector
 * @param {Object} client The node-mysql? client object
 */
function CouchbaseDB(settings, dataSource) {

  this.name = 'couchbase';
  this._models = {};
  this.settings = settings;
  this.dataSource = dataSource;
  Connector.call(this, 'couchbase', settings);
}

require('util').inherits(CouchbaseDB, Connector);
exports.CouchbaseDB = CouchbaseDB;


/*
	**************************start implementing the interface methods*****************************************
*/

CouchbaseDB.prototype.connect = function (callback) {
  var self = this;
  if (self.db) {
	process.nextTick(function () {
		callback && callback(null, self.db);
	});
  } else {
	self.myCluster = new couchbase.Cluster(self.settings.connectUrl);
	callback && callback(null, self.db);