downstairs
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -15,4 +15,12 @@ var Table = {} | ||
for (var key in conditions){ | ||
var clause = Model.sql[key].equals(conditions[key]); | ||
clauses.push(clause); | ||
if (Model.sql[key]) { | ||
if (conditions[key]) { | ||
var clause = Model.sql[key].equals(conditions[key]); | ||
clauses.push(clause); | ||
} | ||
else { | ||
var clause = Model.sql[key].isNull(); | ||
clauses.push(clause); | ||
} | ||
} | ||
} | ||
@@ -19,0 +27,0 @@ |
{ | ||
"name": "downstairs", | ||
"description": "A light ORM wrapped about brianc's node-sql and node-pg", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "https://github.com/moneytribeaustralia/downstairs.js", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -44,4 +44,4 @@ var pg = require('pg') | ||
, 'updated_at' | ||
, 'is_active' | ||
, 'email' | ||
, 'null_field' | ||
, 'password' | ||
@@ -58,2 +58,3 @@ ] | ||
email character varying(512) unique,\ | ||
null_field character varying(50),\ | ||
password character varying(512), \ | ||
@@ -60,0 +61,0 @@ CONSTRAINT pk_users PRIMARY KEY (id)\ |
@@ -23,2 +23,3 @@ var Downstairs = require('../lib/downstairs') | ||
, 'email' | ||
//, 'null_field' | ||
, 'password' | ||
@@ -36,4 +37,3 @@ ] | ||
describe('Tables creating Model constructors', function(){ | ||
describe('Tables creating Model constructors', function(done){ | ||
it('returns a Model (a constructor function), with a mappings property', function(){ | ||
@@ -73,3 +73,3 @@ var User = Table.model('User', userSQL); | ||
User.find({username: 'fred', email: 'fred@moneytribe.com.au'} , function(err, user){ | ||
User.find({ username: 'fred', email: 'fred@moneytribe.com.au' } , function(err, user){ | ||
should.exist(user); | ||
@@ -82,2 +82,15 @@ user.username.should.equal('fred'); | ||
it('finds a record with a where JSON condition including a null field', function(done) { | ||
var User = Table.model('User', userSQL); | ||
var data = {password: '5f4dcc3b5aa765d61d8327deb882cf99', username: 'fred', email: 'fred@moneytribe.com.au' }; | ||
ectypes.User.create(data, function(err, results) { | ||
User.find({ username: 'fred', null_field: null } , function(err, user){ | ||
should.exist(user); | ||
user.username.should.equal('fred'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
it('finds all records with an empty object JSON condition', function(done) { | ||
@@ -84,0 +97,0 @@ var User = Table.model('User', userSQL); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
42239
959
0