cassandra-helpers 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 8cb34bc57cff105ccf5010bef074312b3048de3f491917610656baa30aba7396
4
- data.tar.gz: 530f52c6c2d06562133750ab76769ecbd1ab315c36bf3ba6b8be9cb7d32aaea4
3
+ metadata.gz: 1d41d12e68e374a2c130e10a148f3bc8850835f4a85ac36fcdf1b878c3805172
4
+ data.tar.gz: 466f3b645002c4024c95ef640b86b3d5b54eef4e3eae1eb03221c0ebd8be8c61
5
5
  SHA512:
6
- metadata.gz: 7c574501bfb105590c8433d7bbc7d35e1a67e0f89672b11bead4830773f98f20d2083b19242f02342bddfc3c64a13ac507da34c1452a8ca6fefcf98cc751c529
7
- data.tar.gz: 31ad252b4561fd564d9015947d7935fd28997727b3ce4d1ca812ed61a20f9ce58eddf137b8ddbe5e9e41ecf11e8da4486b4226b314cc475a2e86254b58dbaae7
6
+ metadata.gz: d6cc3059ae14267cc5058a3eeaacf15af4cb326546515d6704995f27f148767806d79756a204d4f1690e21185745422155487ec260e96345abb87b8a5c452c9a
7
+ data.tar.gz: 6ac7a000ba60708d6a6087b0380c45355b841b723b69a19030e33f9ebd37361cb0689737a7be6f4d4aea466649db7866d01eccabdc6aa72b617028b1f54c00c3
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'cassandra-helpers'
5
- s.version = '0.1.0'
5
+ s.version = '0.1.1'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'Cassandra Helper Methods'
8
8
  s.description = 'Utility methods for working with Cassandra'
@@ -47,6 +47,12 @@ module CassandraHelpers
47
47
  end
48
48
  end
49
49
 
50
+ def find_record(session, table, keys)
51
+ cql = "SELECT * FROM #{Cassandra::Util.escape_name(table.name)} WHERE "
52
+ cql += table.primary_key.map { |key| "#{Cassandra::Util.escape_name(key.name)} = #{Cassandra::Util.encode_object(keys[key.name])}" }.join(' AND ')
53
+ execute_query(session, cql)
54
+ end
55
+
50
56
  def each_record(session, cql, page_size = 100)
51
57
  result = execute_query(session, cql, page_size: page_size)
52
58
  loop do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch