Comparing version 0.3.8 to 0.3.9
@@ -21,3 +21,5 @@ // Generated by CoffeeScript 1.4.0 | ||
model = this.models[model]; | ||
return model.create(data, function(error, record) { | ||
return model.create(data, { | ||
skip_log: true | ||
}, function(error, record) { | ||
return callback(error, record); | ||
@@ -33,3 +35,5 @@ }); | ||
model = this.models[model]; | ||
return model["delete"](data, function(error, count) { | ||
return model.where(data)["delete"]({ | ||
skip_log: true | ||
}, function(error, count) { | ||
return callback(error); | ||
@@ -43,3 +47,5 @@ }); | ||
model = _this.models[model]; | ||
return model["delete"](function(error, count) { | ||
return model.where()["delete"]({ | ||
skip_log: true | ||
}, function(error, count) { | ||
return callback(error); | ||
@@ -90,2 +96,3 @@ }); | ||
_this = this; | ||
this.log('<conn>', 'manipulate', commands); | ||
id_to_record_map = {}; | ||
@@ -92,0 +99,0 @@ if (!Array.isArray(commands)) { |
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var ModelPersistence, async, inflector, util, _bindDomain; | ||
var ModelPersistence, async, inflector, util, _, _bindDomain; | ||
@@ -11,2 +11,4 @@ async = require('async'); | ||
_ = require('underscore'); | ||
_bindDomain = function(fn) { | ||
@@ -25,8 +27,12 @@ var d; | ||
ModelPersistence.create = function(data, callback) { | ||
ModelPersistence.create = function(data, options, callback) { | ||
if (typeof data === 'function') { | ||
callback = data; | ||
data = {}; | ||
options = {}; | ||
} else if (typeof options === 'function') { | ||
callback = options; | ||
options = {}; | ||
} | ||
return this.build(data).save(callback); | ||
return this.build(data).save(options, callback); | ||
}; | ||
@@ -97,3 +103,3 @@ | ||
ModelPersistence.prototype._create = function(callback) { | ||
ModelPersistence.prototype._create = function(options, callback) { | ||
var ctor, data, | ||
@@ -110,3 +116,5 @@ _this = this; | ||
ctor = this.constructor; | ||
ctor._connection.log(ctor._name, 'create', data); | ||
if (!(options != null ? options.skip_log : void 0)) { | ||
ctor._connection.log(ctor._name, 'create', data); | ||
} | ||
return ctor._adapter.create(ctor._name, data, _bindDomain(function(error, id) { | ||
@@ -175,3 +183,3 @@ var foreign_key; | ||
ModelPersistence.prototype._update = function(callback) { | ||
ModelPersistence.prototype._update = function(options, callback) { | ||
var adapter, ctor, data, path, schema, | ||
@@ -193,3 +201,5 @@ _this = this; | ||
} | ||
ctor._connection.log(ctor._name, 'update', data); | ||
if (!(options != null ? options.skip_log : void 0)) { | ||
ctor._connection.log(ctor._name, 'update', data); | ||
} | ||
return adapter.updatePartial(ctor._name, data, { | ||
@@ -210,3 +220,5 @@ id: this.id | ||
} | ||
ctor._connection.log(ctor._name, 'update', data); | ||
if (!(options != null ? options.skip_log : void 0)) { | ||
ctor._connection.log(ctor._name, 'update', data); | ||
} | ||
return ctor._adapter.update(ctor._name, data, _bindDomain(function(error) { | ||
@@ -236,5 +248,5 @@ if (error) { | ||
} | ||
return _this.save({ | ||
return _this.save(_.extend({}, options, { | ||
validate: false | ||
}, callback); | ||
}), callback); | ||
}); | ||
@@ -246,3 +258,3 @@ return; | ||
this._runCallbacks('update', 'before'); | ||
return this._update(function(error, record) { | ||
return this._update(options, function(error, record) { | ||
_this._runCallbacks('update', 'after'); | ||
@@ -254,3 +266,3 @@ _this._runCallbacks('save', 'after'); | ||
this._runCallbacks('create', 'before'); | ||
return this._create(function(error, record) { | ||
return this._create(options, function(error, record) { | ||
_this._runCallbacks('create', 'after'); | ||
@@ -257,0 +269,0 @@ _this._runCallbacks('save', 'after'); |
@@ -230,6 +230,10 @@ // Generated by CoffeeScript 1.4.0 | ||
Query.prototype["delete"] = function(callback) { | ||
Query.prototype["delete"] = function(options, callback) { | ||
if (this._model._waitingForReady(this, this["delete"], arguments)) { | ||
return; | ||
} | ||
if (typeof options === 'function') { | ||
callback = options; | ||
options = {}; | ||
} | ||
if (this._id) { | ||
@@ -241,5 +245,7 @@ this._conditions.push({ | ||
} | ||
this._connection.log(this._name, 'delete', { | ||
conditions: this._conditions | ||
}); | ||
if (!(options != null ? options.skip_log : void 0)) { | ||
this._connection.log(this._name, 'delete', { | ||
conditions: this._conditions | ||
}); | ||
} | ||
return this._adapter["delete"](this._name, this._conditions, _bindDomain(callback)); | ||
@@ -246,0 +252,0 @@ }; |
{ | ||
"name": "cormo", | ||
"description": "ORM framework for Node.js", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "orm", |
148363
3976