Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ee-orm

Package Overview
Dependencies
Maintainers
2
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-orm - npm Package Compare versions

Comparing version 0.3.14 to 0.3.15

28

lib/ModelBuilder.js

@@ -302,8 +302,9 @@ !function(){

this._belongsTo[relationName] = new RelatingSet({
orm: thisContext.orm
, definition: belongsTo
, column: column
, related: this
, database: thisContext.databaseName
, isMapping: false
orm: thisContext.orm
, definition: belongsTo
, column: column
, related: this
, database: thisContext.databaseName
, ContainingModel: thisContext.Model
, isMapping: false
});

@@ -360,9 +361,10 @@ }

this._mappings[mappingName] = new RelatingSet({
orm: thisContext.orm
, definition: mapping
, column: column
, related: this
, database: thisContext.databaseName
, isMapping: true
, getDatabase: thisContext.getDatabase
orm: thisContext.orm
, definition: mapping
, column: column
, related: this
, database: thisContext.databaseName
, ContainingModel: thisContext.Model
, isMapping: true
, getDatabase: thisContext.getDatabase
});

@@ -369,0 +371,0 @@ }

@@ -28,2 +28,3 @@ !function(){

Class.define(this, '_error' , Class(null).Writable());
Class.define(this, 'Model' , Class(options.ContainingModel).Enumerable())
Class.define(this, 'isMapping' , Class(!!options.isMapping));

@@ -30,0 +31,0 @@ }

@@ -10,5 +10,30 @@ !function(){

module.exports = new Class({
var Helpers = new Class({
fn: function(fn, values, alias) {
return function() {
return {
fn : fn
, values : values
, value : values
, alias : alias
};
};
}
, operator: function(operator, value) {
return function() {
return {
operator : operator
, value : value
};
};
}
});
var helpers = new Helpers();
module.exports = new Class({
// alias
alias: function(){

@@ -31,3 +56,3 @@ var len = arguments.length

// logic
, or: function(first){

@@ -46,132 +71,69 @@ var a = type.array(first) ? first : Array.prototype.slice.call(arguments);

, in: function(values) {
return function(){
return {
fn: 'in'
, values: values
};
};
// aggregate functions
, count: function(field, alias) {
return helpers.fn('count', field, alias);
}
, max: function(field, alias) {
return helpers.fn('max', field, alias);
}
, min: function(field, alias) {
return helpers.fn('min', field, alias);
}
, avg: function(field, alias) {
return helpers.fn('avg', field, alias);
}
, sum: function(field, alias) {
return helpers.fn('sum', field, alias);
}
// filters
, like: function(value) {
return helpers.fn('like', value);
}
, notLike: function(value) {
return helpers.fn('notLike', value);
}
, in: function(values) {
return helpers.fn('in', values);
}
, notIn: function(values) {
return function(){
return {
fn: 'notIn'
, values: values
};
};
return helpers.fn('notIn', values);
}
, notNull: function() {
return function(){
return {
fn: 'notNull'
};
};
return helpers.fn('notNull');
}
, equal: function(value) {
return function(){
return {
operator: '='
, value: value
}
}
return helpers.operator('=', value);
}
, notEqual: function(value) {
return function(){
return {
operator: '!='
, value: value
}
}
return helpers.operator('!=', value);
}
, gt: function(value) {
return function(){
return {
operator: '>'
, value: value
}
}
return helpers.operator('>', value);
}
, gte: function(value) {
return function(){
return {
operator: '>='
, value: value
}
}
return helpers.operator('>=', value);
}
, lt: function(value) {
return function(){
return {
operator: '<'
, value: value
}
}
return helpers.operator('<', value);
}
, lte: function(value) {
return function(){
return {
operator: '<='
, value: value
}
}
return helpers.operator('<=', value);
}
, not: function(value) {
return function(){
return {
operator: 'not'
, value: value
}
}
return helpers.operator('not', value);
}
, is: function(value) {
return function(){
return {
operator: 'is'
, value: value
}
}
return helpers.operator('is', value);
}
, like: function(value) {
return function(){
return {
fn: 'like'
, value: value
}
}
}
, notLike: function(value) {
return function(){
return {
fn: 'notLike'
, value: value
}
}
}
});
});
}();
{
"name" : "ee-orm"
, "description" : "An easy to use ORM for node.js. Supports advanced eager loading, complex queries, joins, transactions, complex database clusters & connection pooling."
, "version" : "0.3.14"
, "description" : "An easy to use ORM for node.js. Supports eager loading, complex queries, joins, transactions, complex database clusters & connection pooling."
, "version" : "0.3.15"
, "homepage" : "https://github.com/eventEmitter/ee-orm"

@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)"

@@ -27,3 +27,3 @@

db.event(['id']).group('id').find(cb);
db.event([ORM.count('id', 'eventCount')]).find(cb);

@@ -30,0 +30,0 @@

@@ -513,2 +513,6 @@

});
/*it('with aggregate function count', function(done){
db.event([ORM.count('id', 'eventCount')]).group('id').find(expect('[{"id":4},{"id":1},{"id":3},{"id":2}]', done));
});*/
});

@@ -566,17 +570,29 @@

it('Filtering the like operator', function(done){
it('Filtering using the like operator', function(done){
db.event({title: ORM.like('Mapp%')}).find(expect('[{"id":3,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":true},{"id":2,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}]', done));
});
it('Filtering the notLike operator', function(done){
it('Filtering using the notLike operator', function(done){
db.event({title: ORM.notLike('Mapp%')}).find(expect('[{"id":4,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":"2014-05-13T16:53:20.000Z","canceled":null},{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}]', done));
});
it('Filtering the notEqual operator', function(done){
it('Filtering using the notEqual operator', function(done){
db.event({title: ORM.notEqual('hui')}).find(expect('[{"id":3,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":true},{"id":4,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":"2014-05-13T16:53:20.000Z","canceled":null},{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null},{"id":2,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}]', done));
});
/*it('Filtering using a subquery should work', function(done){
db.event().getVenue({
county: db.country({name: 'ch'}).get
}).find(function(err, result){
log(err, result);
});
});*/
});
describe('Connection Pooling', function(){

@@ -583,0 +599,0 @@ it('should be able to insert 1000 items at once', function(done){

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc