Comparing version 0.11.6 to 0.12.0
@@ -102,7 +102,7 @@ !function() { | ||
if (parts.length === 1) { | ||
return rootQuery.getResource().getAliasName(); | ||
return rootQuery.getresource().getAliasName(); | ||
} | ||
else if (parts.length > 1) { | ||
targetEntity = this._joinPath(rootQuery, parts.slice(0, -1)); | ||
return targetEntity.getResource().getAliasName(); | ||
return targetEntity.getresource().getAliasName(); | ||
} | ||
@@ -109,0 +109,0 @@ else throw new Error('Failed to determine entity!'); |
@@ -25,3 +25,3 @@ !function(){ | ||
, getEntityName: function() { | ||
, getentityName: function() { | ||
return this.tableName; | ||
@@ -54,2 +54,3 @@ } | ||
// set or define the root resource | ||
@@ -98,4 +99,4 @@ if (options.rootResource) Class.define(this, '_rootResource', Class(options.rootResource)); | ||
, setQueryBuilder: function(qb) { | ||
if (!this.getRootResource().advancedQueryQuerybuilders)this.getRootResource().advancedQueryQuerybuilders = []; | ||
this.getRootResource().advancedQueryQuerybuilders.push(qb); | ||
if (!this.getrootResource().advancedQueryQuerybuilders)this.getrootResource().advancedQueryQuerybuilders = []; | ||
this.getrootResource().advancedQueryQuerybuilders.push(qb); | ||
} | ||
@@ -141,3 +142,3 @@ | ||
*/ | ||
, getDefinition: function() { | ||
, getdefinition: function() { | ||
return this._definition; | ||
@@ -150,3 +151,3 @@ } | ||
*/ | ||
, getRootResource: function() { | ||
, getrootResource: function() { | ||
return this._rootResource; | ||
@@ -192,3 +193,3 @@ } | ||
else { | ||
instance.getResource().forceJoin(); | ||
instance.getresource().forceJoin(); | ||
} | ||
@@ -298,3 +299,3 @@ | ||
else { | ||
instance.getResource().forceJoin(); | ||
instance.getresource().forceJoin(); | ||
} | ||
@@ -404,3 +405,3 @@ | ||
else { | ||
instance.getResource().forceJoin(); | ||
instance.getresource().forceJoin(); | ||
} | ||
@@ -566,4 +567,8 @@ | ||
, _parseSelect: function(query, tablename, select) { | ||
select.forEach(function(item){ | ||
/** | ||
* apply a select statement to a query | ||
*/ | ||
, _parseSelect: function(query, tableName, select) { | ||
select.forEach(function(item) { | ||
query.select.push(item); | ||
@@ -625,7 +630,14 @@ }.bind(this)); | ||
/** | ||
* set the order statement | ||
* | ||
* @param <string> column | ||
* @param <boolea> true if desc | ||
* @param <array> optional array to sort by | ||
*/ | ||
, order: function(column, desc, byArray) { | ||
if (!this._resource.query.order) this._resource.query.order = []; | ||
, order: function(column, desc, byArray) { | ||
if (!this._resource.query.order) this._resource.query.order = []; | ||
this._resource.query.order.push({ | ||
entity : this.tableName+(this.getResource().isRootResource() ? this._resource.id : '') | ||
entity : this.tableName+(this.getresource().isRootResource() ? this._resource.id : '') | ||
, property : column | ||
@@ -639,2 +651,9 @@ , desc : !!desc | ||
/** | ||
* set ASC the order statement | ||
* | ||
* @param <string> column | ||
* @param <array> optional array to sort by | ||
*/ | ||
, orderAsc: function(column, byArray) { | ||
@@ -645,2 +664,9 @@ this.order(column, false, byArray); | ||
/** | ||
* set DESC the order statement | ||
* | ||
* @param <string> column | ||
* @param <array> optional array to sort by | ||
*/ | ||
, orderDesc: function(column, byArray) { | ||
@@ -670,3 +696,3 @@ this.order(column, true, byArray); | ||
, getResource: function() { | ||
, getresource: function() { | ||
return this._resource; | ||
@@ -693,3 +719,3 @@ } | ||
, setDebugMode: function(status) { | ||
if (type.undefined(status) || status) this.getRootResource().debug(); | ||
if (type.undefined(status) || status) this.getrootResource().debug(); | ||
return this; | ||
@@ -703,3 +729,3 @@ } | ||
, debug: function() { | ||
this.getRootResource().debug(); | ||
this.getrootResource().debug(); | ||
return this; | ||
@@ -769,3 +795,3 @@ } | ||
, l = arguments.length | ||
, query = this.getRootResource().getQuery() | ||
, query = this.getrootResource().getQuery() | ||
, offset, callback, transaction, setSize; | ||
@@ -772,0 +798,0 @@ |
{ | ||
"name" : "ee-orm" | ||
, "description" : "ORM for postgres and mysql. Loads and saves referenced entites, executes complex queries, supports joins, transactions, complex database clusters, connection pooling and much more. No conventions. MIT Licence" | ||
, "version" : "0.11.6" | ||
, "version" : "0.12.0" | ||
, "homepage" : "https://github.com/eventEmitter/ee-orm" | ||
@@ -27,4 +27,4 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)" | ||
, "ee-db-cluster" : "0.2.x" | ||
, "ee-mysql-connection" : "^0.5.1" | ||
, "ee-postgres-connection" : "0.8.x" | ||
, "ee-mysql-connection" : "0.6.x" | ||
, "ee-postgres-connection" : "0.9.x" | ||
, "es6-promise" : "2.0.x" | ||
@@ -31,0 +31,0 @@ } |
16
test.js
@@ -25,14 +25,8 @@ | ||
log(db.event.getDefinition()) | ||
db.event().find().then(function(list) { | ||
list = list.toArray(); | ||
new db.tree({left: 1, right: 2}).save().then(function(item) { | ||
log(item); | ||
return db.tree('*').find(); | ||
}).then(log).catch(log); | ||
log.error(list.length); | ||
log.wtf(list instanceof Array, [1,2].concat(list)); | ||
list.push({}); | ||
list.length = 1; | ||
log.warn(list, list.length); | ||
}).catch(log); | ||
/* | ||
@@ -39,0 +33,0 @@ db.shop(['*'], {id: 1}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
301015
5715
+ Addedee-mysql-connection@0.6.0(transitive)
+ Addedee-mysql-query-builder@0.2.0(transitive)
+ Addedee-postgres-connection@0.9.0(transitive)
+ Addedee-postgres-query-builder@0.3.0(transitive)
+ Addedee-query-builder@0.4.0(transitive)
- Removedee-mysql-connection@0.5.1(transitive)
- Removedee-mysql-query-builder@0.1.1(transitive)
- Removedee-postgres-connection@0.8.0(transitive)
- Removedee-postgres-query-builder@0.1.1(transitive)
- Removedee-query-builder@0.3.2(transitive)
Updatedee-mysql-connection@0.6.x
Updatedee-postgres-connection@0.9.x