express-cassandra
Advanced tools
Comparing version 0.4.10 to 0.4.11
@@ -88,2 +88,17 @@ var fs = require('fs'); | ||
doBatch: function(queries, callback) { | ||
var randomModel = this.modelInstance[Object.keys(this.modelInstance)[0]]; | ||
var builtQueries = []; | ||
for(var i=0;i<queries;i++) { | ||
builtQueries.push({ | ||
query: queries[i], | ||
params: [] | ||
}); | ||
} | ||
randomModel.execute_batch(builtQueries, function(err){ | ||
if(err) callback(err); | ||
else callback(); | ||
}); | ||
}, | ||
get instance() { | ||
@@ -90,0 +105,0 @@ return this.modelInstance; |
@@ -607,2 +607,4 @@ var util = require('util'), | ||
field_relation = {'$eq': field_relation}; | ||
else if(typeof field_relation == 'object' && (field_relation instanceof cql.types.Uuid || field_relation instanceof cql.types.TimeUuid)) | ||
field_relation = {'$eq': field_relation.toString()}; | ||
else if(typeof field_relation != 'object') | ||
@@ -609,0 +611,0 @@ throw(build_error('model.find.invalidrelob', k, field_relation)); |
{ | ||
"name": "express-cassandra", | ||
"version": "0.4.10", | ||
"version": "0.4.11", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "async": "^1.0.0", |
@@ -6,2 +6,3 @@ var models = require('../index'); | ||
var current_time = Date.now(); | ||
var event_id = models.timeuuid(); | ||
@@ -293,3 +294,3 @@ describe('Unit Tests', function(){ | ||
query: "INSERT INTO event (email, id, body) VALUES (?, ?, ?)", | ||
params: ['hello1@h.com', models.timeuuid(), 'hello1'] | ||
params: ['hello1@h.com', event_id, 'hello1'] | ||
}, | ||
@@ -313,2 +314,15 @@ { | ||
describe('#find after batch events',function(){ | ||
it('should find the event with timeuuid in query', function(done) { | ||
models.instance.Event.findOne({email: 'hello1@h.com', id: event_id}, function(err, event){ | ||
if(err) throw err; | ||
models.instance.Event.findOne({email: 'hello1@h.com', id: event.id}, function(err, event){ | ||
if(err) throw err; | ||
event.body.should.equal('hello1'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('#close cassandra connection',function(){ | ||
@@ -315,0 +329,0 @@ it('should close connection to cassandra without errors', function(done) { |
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
113234
2116