Permalink
Browse files

Added additional row slice dynamic methods (versoin 0.2.7)

  • Loading branch information...
bflorian committed Nov 9, 2012
1 parent b4f7f30 commit eaae8137e602db1a0809958373dd1cb5770f8e13
@@ -19,7 +19,7 @@ import com.reachlocal.grails.plugins.cassandra.astyanax.AstyanaxDynamicMethods
class CassandraAstyanaxGrailsPlugin
{
// the plugin version
- def version = "0.2.6"
+ def version = "0.2.7"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.0.0 > *"
View
@@ -1,4 +1,4 @@
-<plugin name='cassandra-astyanax' version='0.2.6' grailsVersion='2.0.0 &gt; *'>
+<plugin name='cassandra-astyanax' version='0.2.7' grailsVersion='2.0.0 &gt; *'>
<author>Bob Florian</author>
<authorEmail>bob.florian@reachlocal.com</authorEmail>
<title>Astyanax Cassandra Client</title>
@@ -24,6 +24,7 @@ import com.netflix.astyanax.model.ColumnFamily
import com.netflix.astyanax.serializers.StringSerializer
import com.netflix.astyanax.thrift.AbstractThriftMutationBatchImpl
import com.netflix.astyanax.thrift.AbstractThriftColumnMutationImpl
+import com.netflix.astyanax.thrift.model.ThriftRowsSliceImpl
/**
* @author: Bob Florian
@@ -85,6 +86,42 @@ class AstyanaxDynamicMethods
result
}
+ ThriftRowsSliceImpl.metaClass.toMap = {
+ def result = [:]
+ delegate.iterator().each {r ->
+ def cols = [:]
+ result[r.key] = cols
+ r.columns.each {c ->
+ cols[c.name] = c
+ }
+ }
+ result
+ }
+
+ ThriftRowsSliceImpl.metaClass.toStringMap = {
+ def result = [:]
+ delegate.iterator().each {r ->
+ def cols = [:]
+ result[r.key] = cols
+ r.columns.each {c ->
+ cols[c.name] = c.stringValue
+ }
+ }
+ result
+ }
+
+ ThriftRowsSliceImpl.metaClass.toLongMap = {
+ def result = [:]
+ delegate.iterator().each {r ->
+ def cols = [:]
+ result[r.key] = cols
+ r.columns.each {c ->
+ cols[c.name] = c.longValue
+ }
+ }
+ result
+ }
+
ThriftColumnOrSuperColumnListImpl.metaClass.toMap = {
def result = [:]
delegate.iterator().each {

0 comments on commit eaae813

Please sign in to comment.