Skip to content

Commit

Permalink
Added additional row slice dynamic methods (versoin 0.2.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
bflorian committed Nov 9, 2012
1 parent b4f7f30 commit eaae813
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CassandraAstyanaxGrailsPlugin.groovy
Expand Up @@ -19,7 +19,7 @@ import com.reachlocal.grails.plugins.cassandra.astyanax.AstyanaxDynamicMethods
class CassandraAstyanaxGrailsPlugin class CassandraAstyanaxGrailsPlugin
{ {
// the plugin version // the plugin version
def version = "0.2.6" def version = "0.2.7"


// the version or versions of Grails the plugin is designed for // the version or versions of Grails the plugin is designed for
def grailsVersion = "2.0.0 > *" def grailsVersion = "2.0.0 > *"
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
@@ -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> <author>Bob Florian</author>
<authorEmail>bob.florian@reachlocal.com</authorEmail> <authorEmail>bob.florian@reachlocal.com</authorEmail>
<title>Astyanax Cassandra Client</title> <title>Astyanax Cassandra Client</title>
Expand Down
Expand Up @@ -24,6 +24,7 @@ import com.netflix.astyanax.model.ColumnFamily
import com.netflix.astyanax.serializers.StringSerializer import com.netflix.astyanax.serializers.StringSerializer
import com.netflix.astyanax.thrift.AbstractThriftMutationBatchImpl import com.netflix.astyanax.thrift.AbstractThriftMutationBatchImpl
import com.netflix.astyanax.thrift.AbstractThriftColumnMutationImpl import com.netflix.astyanax.thrift.AbstractThriftColumnMutationImpl
import com.netflix.astyanax.thrift.model.ThriftRowsSliceImpl


/** /**
* @author: Bob Florian * @author: Bob Florian
Expand Down Expand Up @@ -85,6 +86,42 @@ class AstyanaxDynamicMethods
result 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 = { ThriftColumnOrSuperColumnListImpl.metaClass.toMap = {
def result = [:] def result = [:]
delegate.iterator().each { delegate.iterator().each {
Expand Down

0 comments on commit eaae813

Please sign in to comment.