cassandra_model 0.9.19 → 0.9.21
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 +4 -4
- data/lib/cassandra_model/composite_record_static.rb +16 -20
- data/lib/cassandra_model/data_inquirer.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da8cdc27700ca95add22df7ece2de9e050a09642
|
|
4
|
+
data.tar.gz: 7a9a39c9bd2bf63bb9dc03442461b5f860c95718
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7a028e42484dd36523c86934ef8b9d79045354d720159cc1ab75fadb8cd9e150f2921d40b58038c2ecdd54bff87a80a07ff2fedd83ff976952ce4e5a3b0a484
|
|
7
|
+
data.tar.gz: 39dd8d3525696fc4d183a9b5f077d0cfb24f74da2d86d3c8eeba0db843d023b1257bb38d4c61f9f62da4d6c366769b8d5a722dd83e1eb53d9d0f8e1630a1928d
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module CassandraModel
|
|
2
2
|
module CompositeRecordStatic
|
|
3
|
-
|
|
4
|
-
CK_MUTEX = Mutex.new
|
|
3
|
+
MUTEX = Mutex.new
|
|
5
4
|
|
|
6
5
|
extend Forwardable
|
|
7
6
|
|
|
@@ -24,30 +23,27 @@ module CassandraModel
|
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
def columns
|
|
27
|
-
table_data.composite_columns
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def composite_pk_map
|
|
31
|
-
unless table_data.composite_pk_map
|
|
32
|
-
PK_MUTEX.synchronize do
|
|
33
|
-
return table_data.composite_pk_map if table_data.composite_pk_map
|
|
26
|
+
unless table_data.composite_columns
|
|
27
|
+
MUTEX.synchronize do
|
|
28
|
+
return table_data.composite_columns if table_data.composite_columns
|
|
34
29
|
|
|
35
30
|
table_data.composite_pk_map = {}
|
|
36
|
-
|
|
31
|
+
table_data.composite_ck_map = {}
|
|
32
|
+
table_data.composite_columns = composite_columns.each { |column| define_attribute(column) }
|
|
37
33
|
end
|
|
38
34
|
end
|
|
35
|
+
table_data.composite_columns
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
alias :ensure_attributes_accessible! :columns
|
|
39
|
+
|
|
40
|
+
def composite_pk_map
|
|
41
|
+
ensure_attributes_accessible! unless table_data.composite_columns
|
|
39
42
|
table_data.composite_pk_map
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
def composite_ck_map
|
|
43
|
-
unless table_data.
|
|
44
|
-
CK_MUTEX.synchronize do
|
|
45
|
-
return table_data.composite_ck_map if table_data.composite_ck_map
|
|
46
|
-
|
|
47
|
-
table_data.composite_ck_map = {}
|
|
48
|
-
columns
|
|
49
|
-
end
|
|
50
|
-
end
|
|
46
|
+
ensure_attributes_accessible! unless table_data.composite_columns
|
|
51
47
|
table_data.composite_ck_map
|
|
52
48
|
end
|
|
53
49
|
|
|
@@ -126,8 +122,8 @@ module CassandraModel
|
|
|
126
122
|
|
|
127
123
|
def composite_columns
|
|
128
124
|
internal_columns.map do |column|
|
|
129
|
-
trimmed_column(column, /^rk_/, composite_pk_map) ||
|
|
130
|
-
trimmed_column(column, /^ck_/, composite_ck_map) ||
|
|
125
|
+
trimmed_column(column, /^rk_/, table_data.composite_pk_map) ||
|
|
126
|
+
trimmed_column(column, /^ck_/, table_data.composite_ck_map) ||
|
|
131
127
|
column
|
|
132
128
|
end.uniq
|
|
133
129
|
end
|
|
@@ -55,6 +55,8 @@ module CassandraModel
|
|
|
55
55
|
retype_to(:timestamp)
|
|
56
56
|
when Cassandra::Uuid then
|
|
57
57
|
retype_to(:uuid)
|
|
58
|
+
when String then
|
|
59
|
+
retype_to(:text)
|
|
58
60
|
end
|
|
59
61
|
end
|
|
60
62
|
|
|
@@ -82,6 +84,8 @@ module CassandraModel
|
|
|
82
84
|
default_to(Time.at(0))
|
|
83
85
|
when :uuid then
|
|
84
86
|
default_to(Cassandra::Uuid.new(0))
|
|
87
|
+
when :text then
|
|
88
|
+
default_to('')
|
|
85
89
|
end
|
|
86
90
|
end
|
|
87
91
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cassandra_model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas RM Rogers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cassandra-driver
|