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

Commit

Permalink
Update serializers.js
Browse files Browse the repository at this point in the history
This fixes the issue you run into when trying to use a TimeUUID for a column name on a columnFamily.insert(). The column name cannot be a TimeUUID object, but needs to be a String. (Object keys cannot be objects themselves.)
  • Loading branch information
beatlevic committed Mar 26, 2013
1 parent 43182ec commit 85d924a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/marshal/serializers.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ Serializers.encodeDate = function(val){
* @static
*/
Serializers.encodeUUID = function(val){
return val.toBuffer();
if (val instanceof UUID.UUID) {
return val.toBuffer();
} else {
var uuid = new UUID.UUID(val);
return uuid.toBuffer();
}
};

/**
Expand All @@ -175,7 +180,12 @@ Serializers.encodeUUID = function(val){
* @static
*/
Serializers.encodeTimeUUID = function(val){
return val.toBuffer();
if (val instanceof UUID.TimeUUID) {
return val.toBuffer();
} else {
var timeUUID = new UUID.TimeUUID(val);
return timeUUID.toBuffer();
}
};

module.exports = Serializers;

0 comments on commit 85d924a

Please sign in to comment.