Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

Commit

Permalink
Adding TTL as a valid option for insert
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin French-Owen committed Jun 3, 2012
1 parent 8ca52da commit 2f8dfc0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/column_family.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ function normalizeParameters(list) {
/**
* Gets an array of columns from an object
* @param {Object} columns
* @param {Object} options
* @private
* @memberOf ColumnFamily
* @returns {Array} and array of columns
*/
function getColumns(columns){
function getColumns(columns, options){
var keys = Object.keys(columns), len = keys.length, i = 0, key, value, arr = [],
ts = new Date();

Expand All @@ -128,7 +129,7 @@ function getColumns(columns){
value = '';
}

arr.push(new Column(key, value, ts));
arr.push(new Column(key, value, ts, options.ttl));
}
return arr;
}
Expand Down Expand Up @@ -205,7 +206,7 @@ ColumnFamily.prototype.insert = function(key, columns, options, callback){
}

if(!Array.isArray(columns)){
columns = getColumns(columns);
columns = getColumns(columns, options);
}

var len = columns.length, i = 0, valueMarshaller, col,
Expand Down

0 comments on commit 2f8dfc0

Please sign in to comment.