sessionm-cassandra_object 4.0.22 → 4.0.23
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 871df5085b6c1b1c68df21f8b93a60479a04478a
|
4
|
+
data.tar.gz: 224f0f2aedda5ea4bf009e8675fbb3a4b776f947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b41af1ac8eb7f92af79408fcb0c52a06a24891396c841f65510881e5f5bcf6f7085341e1c64b1847f60e8990cd61049c9a98d8553dad6d8eba38d71adc7fa861
|
7
|
+
data.tar.gz: a675933722b4a149f481149e4613615a7278d05bcd7351becab977e726c5a093b12d9b0e086862a5f7c254d6bcbf86b4e84e3eb0e91227a4e7c19c7be8a6cd47
|
@@ -176,6 +176,16 @@ module CassandraObject
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
+
def add_multiple_columns(column_family, key, hash, opts=nil)
|
180
|
+
async = opts.try(:[], :async)
|
181
|
+
fields = [fields] unless fields.is_a?(Array)
|
182
|
+
|
183
|
+
hash.each do |field, by|
|
184
|
+
query = "UPDATE \"#{column_family}\" SET #{VALUE_FIELD} = #{VALUE_FIELD} + #{by} WHERE #{KEY_FIELD} = #{escape(key, key_type(column_family))} AND #{NAME_FIELD} = #{escape(field, name_type(column_family))};"
|
185
|
+
async ? self.execute_async(query, execute_options(opts)) : self.execute(query, execute_options(opts))
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
179
189
|
def remove(column_family, key, *args)
|
180
190
|
opts = args.pop if args.last.is_a?(Hash)
|
181
191
|
async = opts.try(:[], :async)
|
@@ -6,8 +6,20 @@ describe CassandraObject::Persistence do
|
|
6
6
|
id = SimpleUUID::UUID.new.to_guid
|
7
7
|
Counter.add id, 1, 'foo'
|
8
8
|
expect(Counter.get_counter(id, 'foo')).to eq 1
|
9
|
-
Counter.add id, 1, 'foo'
|
9
|
+
Counter.connection.add Counter.column_family, id, 1, ['foo', 'bar']
|
10
|
+
expect(Counter.get_counter(id, 'foo')).to eq 2
|
11
|
+
expect(Counter.get_counter(id, 'bar')).to eq 1
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "add_multiple_columns" do
|
16
|
+
it "should increment the counter" do
|
17
|
+
id = SimpleUUID::UUID.new.to_guid
|
18
|
+
Counter.connection.add_multiple_columns Counter.column_family, id, {'foo' => 1}
|
19
|
+
expect(Counter.get_counter(id, 'foo')).to eq 1
|
20
|
+
Counter.connection.add_multiple_columns Counter.column_family, id, {'foo' => 1, 'bar' => 1}
|
10
21
|
expect(Counter.get_counter(id, 'foo')).to eq 2
|
22
|
+
expect(Counter.get_counter(id, 'bar')).to eq 1
|
11
23
|
end
|
12
24
|
end
|
13
25
|
end
|
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.
|
4
|
+
version: 4.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doug Youch
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-04-
|
12
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Cassandra ActiveModel
|
15
15
|
email: doug@sessionm.com
|