sessionm-cassandra_object 4.0.16 → 4.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38032c9f5ec7ce780e9e291c07b975220a3121a5
4
- data.tar.gz: 1ff9c90df89d7f0fecc046e8fa7fa86987996367
3
+ metadata.gz: ed329a15a831823620ffa071ce312de25c3f375f
4
+ data.tar.gz: 6f818bc4fc78a4431ee347cb02744381079e4164
5
5
  SHA512:
6
- metadata.gz: 433522051e88b690b42a909db11598d1417c66ab70a2ca1ee007ceee5f5a7cc89ede928d79b116ed866e8d2641cec718a2d6647484886cd07f7ea48b3c2618b9
7
- data.tar.gz: 48342a774013ccc418e5ba43f80093f60754a7452cd06c3ac500161dd1202ea8d6e09a5fefa498c259468b0de4f751a7a5113f68e9e63e2d13dc5665fc5413c1
6
+ metadata.gz: e0e93509823634b57f7933c30c6b37e4dab27663bb484dfafadf23f80a329b56805f34e9cfd2ee101b4d24cdfe2c5bc1f6d6250834921d1a429a289b92bb123b
7
+ data.tar.gz: 48c59e303a94544bc5e668cca4377fdc78e30472a202afb2a02ada6411f4bc6e3f74d10591ac2d279d1da3317669dddc798a8d931d16af017fb68149f6624556
@@ -127,7 +127,19 @@ module CassandraObject
127
127
  end
128
128
 
129
129
  def get_columns_as_hash(column_family, key, columns, opts)
130
- get column_family, key, columns, opts
130
+ async = opts.try(:[], :async)
131
+
132
+ key = "textAsBlob('#{key}')"
133
+
134
+ name_fields = columns.map { |c| "'#{c}'" }.join(', ')
135
+
136
+ query = "SELECT #{NAME_FIELD}, #{VALUE_FIELD} FROM \"#{column_family}\" WHERE #{NAME_FIELD} IN(#{name_fields}) AND #{KEY_FIELD} = #{key}"
137
+
138
+ result = async ? self.execute_async(query, execute_options(opts)) : self.execute(query, execute_options(opts))
139
+ return result if async
140
+
141
+ result
142
+ .inject({}) { |hsh, row| hsh[row[NAME_FIELD]] = row[VALUE_FIELD]; hsh }
131
143
  end
132
144
 
133
145
  def get_value(column_family, key, column, consistency)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'sessionm-cassandra_object'
5
- s.version = '4.0.16'
5
+ s.version = '4.0.17'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sessionm-cassandra_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.16
4
+ version: 4.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch