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.0 to 0.3.1

45

lib/StaticORM.js

@@ -66,2 +66,47 @@ !function(){

}
, gte: function(value) {
return function(){
return {
operator: '>='
, value: value
}
}
}
, lt: function(value) {
return function(){
return {
operator: '<'
, value: value
}
}
}
, lte: function(value) {
return function(){
return {
operator: '<='
, value: value
}
}
}
, not: function(value) {
return function(){
return {
operator: 'not'
, value: value
}
}
}
, is: function(value) {
return function(){
return {
operator: 'is'
, value: value
}
}
}
});

@@ -68,0 +113,0 @@

2

package.json
{
"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.0"
, "version" : "0.3.1"
, "homepage" : "https://github.com/eventEmitter/ee-orm"

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

@@ -30,5 +30,3 @@

}).save(log);*/
db.image.setMappingAccessorName('venue_image', 'venue');
db.image().describeMethods();
db.event({id:1}).getImage(['*']).getVenue(['*']).find(cb);
db.event({canceled: ORM.notNull()}).find(cb);

@@ -35,0 +33,0 @@ /*

@@ -12,3 +12,15 @@

var expect = function(val, cb){
return function(err, result){
try {
assert.equal(JSON.stringify(result), val);
} catch (err) {
return cb(err);
}
cb();
}
};
['POSTGRES'].forEach(function(db){

@@ -288,9 +300,3 @@ var config

, eventLocale: [new db.eventLocale({description: 'some text', language: db.language({id:1})})]
}).save(function(err, event){
if (err) done(err);
else {
assert.equal(JSON.stringify(event), '{"eventLocale":[{"language":{"id":1,"code":"en"},"description":"some text"}],"id":2,"venue":{"id":1,"name":"Dachstock Reitschule"},"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}');
done();
}
});
}).save(expect('{"eventLocale":[{"language":{"id":1,"code":"en"},"description":"some text"}],"id":2,"venue":{"id":1,"name":"Dachstock Reitschule"},"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}', done));
});

@@ -305,9 +311,4 @@

, venue: db.venue({id:1})
}).save(function(err, event){
if (err) done(err);
else {
assert.equal(JSON.stringify(event), '{"image":[{"id":6,"url":"http://imgur.com/gallery/laxsJHr"}],"id":3,"venue":{"id":1,"name":"Dachstock Reitschule"},"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}');
done();
}
});
, canceled: true
}).save(expect('{"image":[{"id":6,"url":"http://imgur.com/gallery/laxsJHr"}],"id":3,"venue":{"id":1,"name":"Dachstock Reitschule"},"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":true}', done));
});

@@ -378,7 +379,16 @@ });

db.event({id:1}).getImage(['*']).getVenue(['*']).find(function(err, events){
db.event({id:1}).getImage(['*']).getVenue(['*']).find(expect('[{"image":[{"id":1,"url":"http://gfycat.com/ScentedPresentKingfisher.gif","venue":[{"id":2,"name":"Dachstock Reitschule"}]}],"id":1}]', done));
});
});
describe('Updating existing Data', function(){
it('for a simple entity using the loaded model should work', function(done){
db.event({id:1}).findOne(function(err, event){
if (err) done(err);
else {
assert.equal(JSON.stringify(events), '[{"image":[{"id":1,"url":"http://gfycat.com/ScentedPresentKingfisher.gif","venue":[{"id":2,"name":"Dachstock Reitschule"}]}],"id":1}]');
done();
event.title = 'Changed title';
event.save(expect('{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}', done));
}

@@ -388,3 +398,45 @@ });

});
describe('[Filtering]', function(){
it('Filter by a value', function(done){
db.event({id: 1}).findOne(expect('{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}', done));
});
it('Filter using null', function(done){
db.event({canceled: null}).find(expect('[{"id":2,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null},{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}]', done));
});
it('Filter using notNull', function(done){
db.event({canceled: ORM.notNull()}).find(expect('[{"id":3,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":true}]', done));
});
it('Using multiple values', function(done){
db.event({id: 1, title:'Changed title'}).findOne(expect('{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}', done));
});
it('Using multiple values on the same column', function(done){
db.event({id: ORM.in([1, 2])}).find(expect('[{"id":2,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null},{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}]', done));
});
it('Records with the > operator', function(done){
db.event({id: ORM.gt(2)}).find(expect('[{"id":3,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":true}]', done));
});
it('Records with the < operator', function(done){
db.event({id: ORM.lt(2)}).find(expect('[{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}]', done));
});
it('Records with the >= operator', function(done){
db.event({id: ORM.gte(2)}).find(expect('[{"id":2,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null},{"id":3,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":true}]', done));
});
it('Records with the <= operator', function(done){
db.event({id: ORM.lte(2)}).find(expect('[{"id":2,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null},{"id":1,"title":"Changed title","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}]', 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