cequel 1.0.0.rc4 → 1.0.0
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/cequel/metal/batch.rb +2 -1
- data/lib/cequel/metal/data_set.rb +12 -6
- data/lib/cequel/metal/deleter.rb +1 -1
- data/lib/cequel/metal/updater.rb +1 -1
- data/lib/cequel/record/collection.rb +6 -3
- data/lib/cequel/record/mass_assignment.rb +3 -0
- data/lib/cequel/record/properties.rb +32 -1
- data/lib/cequel/record/railtie.rb +3 -1
- data/lib/cequel/record/record_generator.rb +24 -0
- data/lib/cequel/record/record_set.rb +2 -2
- data/lib/cequel/record/tasks.rb +14 -5
- data/lib/cequel/schema/column.rb +14 -14
- data/lib/cequel/schema/keyspace.rb +5 -2
- data/lib/cequel/schema/table.rb +2 -1
- data/lib/cequel/type.rb +35 -12
- data/lib/cequel/version.rb +1 -1
- data/templates/record.rb +8 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df5fb851e4ce9dda4900d848faf903c32d63d069
|
4
|
+
data.tar.gz: 38d3ea0bda230427ddb452269976612fc2519026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b43b31556885f28cefc1c0285214448de5dcca189d3fbe414702bd887c4e7e20924affa0a5cc94cdfaa06acbd77c6418626b8ab136c974234d6bf8227f8ef8f4
|
7
|
+
data.tar.gz: e8790f4c65c31b17ec3dc2bd2b838403cbd456e6a95e425a9adc11a8a2a9ec504727d6e842b377c6a8c9002c05a28b875be65736c6407c5e3c32d8303e1aa35c
|
data/lib/cequel/metal/batch.rb
CHANGED
@@ -16,7 +16,8 @@ module Cequel
|
|
16
16
|
# @option options [Integer] :auto_apply If specified, flush the batch
|
17
17
|
# after this many statements have been added.
|
18
18
|
# @option options [Boolean] :unlogged (false) Whether to use an [unlogged
|
19
|
-
# batch](
|
19
|
+
# batch](
|
20
|
+
# http://www.datastax.com/dev/blog/atomic-batches-in-cassandra-1-2).
|
20
21
|
# Logged batches guarantee atomicity (but not isolation) at the
|
21
22
|
# cost of a performance penalty; unlogged batches are useful for bulk
|
22
23
|
# write operations but behave the same as discrete writes.
|
@@ -15,7 +15,8 @@ module Cequel
|
|
15
15
|
# @example Data set targeting only one partition
|
16
16
|
# data_set = database[:posts].where(blog_subdomain: 'cassandra')
|
17
17
|
#
|
18
|
-
# @see http://
|
18
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#selectStmt
|
19
|
+
# CQL documentation for SELECT
|
19
20
|
#
|
20
21
|
class DataSet
|
21
22
|
include Enumerable
|
@@ -73,7 +74,8 @@ module Cequel
|
|
73
74
|
# the insert will overwrite the existing row.
|
74
75
|
# @note If a enclosed in a Keyspace#batch block, this method will be
|
75
76
|
# executed as part of the batch.
|
76
|
-
# @see http://
|
77
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#insertStmt
|
78
|
+
# CQL documentation for INSERT
|
77
79
|
#
|
78
80
|
def insert(data, options = {})
|
79
81
|
inserter(options) { insert(data) }.execute
|
@@ -117,7 +119,8 @@ module Cequel
|
|
117
119
|
# specified by primary key using `where`
|
118
120
|
# @note If a enclosed in a Keyspace#batch block, this method will be
|
119
121
|
# executed as part of the batch.
|
120
|
-
# @see http://
|
122
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#updateStmt
|
123
|
+
# CQL documentation for UPDATE
|
121
124
|
#
|
122
125
|
def update(*args, &block)
|
123
126
|
if block
|
@@ -143,7 +146,8 @@ module Cequel
|
|
143
146
|
# @note This can only be used on counter tables
|
144
147
|
# @since 0.5.0
|
145
148
|
# @see #decrement
|
146
|
-
# @see http://
|
149
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#counters
|
150
|
+
# CQL documentation for counter columns
|
147
151
|
#
|
148
152
|
def increment(deltas, options = {})
|
149
153
|
incrementer(options) { increment(deltas) }.execute
|
@@ -158,7 +162,8 @@ module Cequel
|
|
158
162
|
# @return [void]
|
159
163
|
#
|
160
164
|
# @see #increment
|
161
|
-
# @see http://
|
165
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#counters
|
166
|
+
# CQL documentation for counter columns
|
162
167
|
# @since 0.5.0
|
163
168
|
#
|
164
169
|
def decrement(deltas, options = {})
|
@@ -410,7 +415,8 @@ module Cequel
|
|
410
415
|
#
|
411
416
|
# @note If enclosed in a Keyspace#batch block, this method will be
|
412
417
|
# executed as part of the batch.
|
413
|
-
# @see http://
|
418
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#deleteStmt
|
419
|
+
# CQL documentation for DELETE
|
414
420
|
#
|
415
421
|
def delete(*columns, &block)
|
416
422
|
options = columns.extract_options!
|
data/lib/cequel/metal/deleter.rb
CHANGED
@@ -9,7 +9,7 @@ module Cequel
|
|
9
9
|
# @note This class should not be instantiated directly
|
10
10
|
# @see DataSet#delete
|
11
11
|
# @see
|
12
|
-
# http://
|
12
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#deleteStmt
|
13
13
|
# CQL documentation for DELETE
|
14
14
|
# @since 1.0.0
|
15
15
|
#
|
data/lib/cequel/metal/updater.rb
CHANGED
@@ -7,7 +7,7 @@ module Cequel
|
|
7
7
|
# @see DataSet#update
|
8
8
|
# @see Deleter
|
9
9
|
# @see
|
10
|
-
# http://
|
10
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#updateStmt
|
11
11
|
# CQL UPDATE documentation
|
12
12
|
# @since 1.0.0
|
13
13
|
#
|
@@ -152,7 +152,8 @@ module Cequel
|
|
152
152
|
# The value of a list column in a {Record} instance. List collections
|
153
153
|
# encapsulate and behave like the built-in `Array` type.
|
154
154
|
#
|
155
|
-
# @see http://
|
155
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#list
|
156
|
+
# CQL documentation for the list type
|
156
157
|
# @since 1.0.0
|
157
158
|
#
|
158
159
|
class List < DelegateClass(Array)
|
@@ -343,7 +344,8 @@ module Cequel
|
|
343
344
|
# unique set of elements. Encapsulates and behaves like the `Set` type from
|
344
345
|
# the standard library.
|
345
346
|
#
|
346
|
-
# @see http://
|
347
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#set
|
348
|
+
# CQL documentation for set columns
|
347
349
|
# @since 1.0.0
|
348
350
|
#
|
349
351
|
class Set < DelegateClass(::Set)
|
@@ -418,7 +420,8 @@ module Cequel
|
|
418
420
|
# The value of a `map` column in a {Record} instance. Encapsulates and
|
419
421
|
# behaves like a built-in `Hash`.
|
420
422
|
#
|
421
|
-
# @see http://
|
423
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#map
|
424
|
+
# CQL documentation for map columns
|
422
425
|
# @since 1.0.0
|
423
426
|
#
|
424
427
|
class Map < DelegateClass(::Hash)
|
@@ -6,6 +6,8 @@ end
|
|
6
6
|
|
7
7
|
module Cequel
|
8
8
|
module Record
|
9
|
+
# rubocop:disable LineLength
|
10
|
+
|
9
11
|
#
|
10
12
|
# Cequel supports mass-assignment protection in both the Rails 3 and Rails
|
11
13
|
# 4 paradigms. Rails 3 applications may define `attr_protected` and
|
@@ -20,6 +22,7 @@ module Cequel
|
|
20
22
|
# @since 1.0.0
|
21
23
|
#
|
22
24
|
module MassAssignment
|
25
|
+
# rubocop:enable LineLength
|
23
26
|
extend ActiveSupport::Concern
|
24
27
|
|
25
28
|
included do
|
@@ -64,6 +64,8 @@ module Cequel
|
|
64
64
|
module ClassMethods
|
65
65
|
protected
|
66
66
|
|
67
|
+
# rubocop:disable LineLength
|
68
|
+
|
67
69
|
# @!visibility public
|
68
70
|
|
69
71
|
#
|
@@ -86,7 +88,7 @@ module Cequel
|
|
86
88
|
# defines key columns.
|
87
89
|
#
|
88
90
|
# @see
|
89
|
-
# http://
|
91
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#createTablepartitionClustering
|
90
92
|
# CQL documentation on compound primary keys
|
91
93
|
#
|
92
94
|
def key(name, type, options = {})
|
@@ -100,6 +102,8 @@ module Cequel
|
|
100
102
|
set_attribute_default(name, default)
|
101
103
|
end
|
102
104
|
|
105
|
+
# rubocop:enable LineLength
|
106
|
+
|
103
107
|
#
|
104
108
|
# Define a data column
|
105
109
|
#
|
@@ -252,6 +256,30 @@ module Cequel
|
|
252
256
|
end
|
253
257
|
end
|
254
258
|
|
259
|
+
#
|
260
|
+
# Read an attribute
|
261
|
+
#
|
262
|
+
# @param column_name [Symbol] the name of the column
|
263
|
+
# @return the value of that column
|
264
|
+
# @raise [MissingAttributeError] if the attribute has not been loaded
|
265
|
+
# @raise [UnknownAttributeError] if the attribute does not exist
|
266
|
+
#
|
267
|
+
def [](column_name)
|
268
|
+
read_attribute(column_name)
|
269
|
+
end
|
270
|
+
|
271
|
+
#
|
272
|
+
# Write an attribute
|
273
|
+
#
|
274
|
+
# @param column_name [Symbol] name of the column to write
|
275
|
+
# @param value the value to write to the column
|
276
|
+
# @return [void]
|
277
|
+
# @raise [UnknownAttributeError] if the attribute does not exist
|
278
|
+
#
|
279
|
+
def []=(column_name, value)
|
280
|
+
write_attribute(column_name, value)
|
281
|
+
end
|
282
|
+
|
255
283
|
#
|
256
284
|
# @return [Boolean] true if this record has the same type and key
|
257
285
|
# attributes as the other record
|
@@ -289,6 +317,9 @@ module Cequel
|
|
289
317
|
end
|
290
318
|
|
291
319
|
def write_attribute(name, value)
|
320
|
+
unless self.class.reflect_on_column(name)
|
321
|
+
fail UnknownAttributeError, "unknown attribute: #{name}"
|
322
|
+
end
|
292
323
|
@attributes[name] = value
|
293
324
|
end
|
294
325
|
|
@@ -4,6 +4,7 @@ module Cequel
|
|
4
4
|
# @since 0.1.0
|
5
5
|
class Railtie < Rails::Railtie
|
6
6
|
config.cequel = Record
|
7
|
+
config.app_generators.orm :cequel
|
7
8
|
|
8
9
|
def self.app_name
|
9
10
|
Rails.application.railtie_name.sub(/_application$/, '')
|
@@ -41,7 +42,8 @@ module Cequel
|
|
41
42
|
end
|
42
43
|
|
43
44
|
generators do
|
44
|
-
require 'cequel/record/configuration_generator
|
45
|
+
require 'cequel/record/configuration_generator'
|
46
|
+
require 'cequel/record/record_generator'
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Cequel
|
2
|
+
module Record
|
3
|
+
#
|
4
|
+
# Rails generator to create a record class
|
5
|
+
#
|
6
|
+
# @since 1.0.0
|
7
|
+
#
|
8
|
+
class RecordGenerator < Rails::Generators::NamedBase
|
9
|
+
namespace 'cequel'
|
10
|
+
source_root File.expand_path('../../../../templates', __FILE__)
|
11
|
+
argument :attributes, type: :array, default: [],
|
12
|
+
banner: 'field:type[:index] field:type[:index]'
|
13
|
+
|
14
|
+
#
|
15
|
+
# Create a Record implementation
|
16
|
+
#
|
17
|
+
def create_record
|
18
|
+
template 'record.rb',
|
19
|
+
File.join('app/models', class_path, "#{file_name}.rb")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -152,7 +152,7 @@ module Cequel
|
|
152
152
|
# applied
|
153
153
|
#
|
154
154
|
# @see
|
155
|
-
# http://
|
155
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#selectStmt
|
156
156
|
# CQL SELECT documentation
|
157
157
|
#
|
158
158
|
# @return [Array,RecordSet]
|
@@ -169,7 +169,7 @@ module Cequel
|
|
169
169
|
# @return [RecordSet] record set with limit applied
|
170
170
|
#
|
171
171
|
# @see
|
172
|
-
# http://
|
172
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#selectStmt
|
173
173
|
# CQL SELECT documentation
|
174
174
|
#
|
175
175
|
def limit(count)
|
data/lib/cequel/record/tasks.rb
CHANGED
@@ -23,11 +23,20 @@ namespace :cequel do
|
|
23
23
|
|
24
24
|
require_dependency(file)
|
25
25
|
|
26
|
-
watch_stack.new_constants
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
new_constants = watch_stack.new_constants
|
27
|
+
if new_constants.empty?
|
28
|
+
new_constants << File.basename(file, '.rb').classify
|
29
|
+
end
|
30
|
+
|
31
|
+
new_constants.each do |class_name|
|
32
|
+
begin
|
33
|
+
clazz = class_name.constantize
|
34
|
+
rescue NameError # rubocop:disable HandleExceptions
|
35
|
+
else
|
36
|
+
if clazz.ancestors.include?(Cequel::Record)
|
37
|
+
clazz.synchronize_schema
|
38
|
+
puts "Synchronized schema for #{class_name}"
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
33
42
|
end
|
data/lib/cequel/schema/column.rb
CHANGED
@@ -19,12 +19,14 @@ module Cequel
|
|
19
19
|
@name, @type = name, type
|
20
20
|
end
|
21
21
|
|
22
|
+
# rubocop:disable LineLength
|
23
|
+
|
22
24
|
#
|
23
25
|
# @return [Boolean] true if this is a key column
|
24
26
|
#
|
25
27
|
# @see
|
26
|
-
# http://
|
27
|
-
#
|
28
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#createTablepartitionClustering
|
29
|
+
# CQL3 key documentation
|
28
30
|
#
|
29
31
|
def key?
|
30
32
|
partition_key? || clustering_column?
|
@@ -34,8 +36,8 @@ module Cequel
|
|
34
36
|
# @return [Boolean] true if this is a partition key column
|
35
37
|
#
|
36
38
|
# @see
|
37
|
-
# http://
|
38
|
-
#
|
39
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#createTablepartitionClustering
|
40
|
+
# CQL3 key documentation
|
39
41
|
#
|
40
42
|
def partition_key?
|
41
43
|
false
|
@@ -45,20 +47,18 @@ module Cequel
|
|
45
47
|
# @return [Boolean] true if this is a clustering column
|
46
48
|
#
|
47
49
|
# @see
|
48
|
-
# http://
|
49
|
-
#
|
50
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#createTablepartitionClustering
|
51
|
+
# CQL3 key documentation
|
50
52
|
#
|
51
53
|
def clustering_column?
|
52
54
|
false
|
53
55
|
end
|
54
56
|
|
57
|
+
# rubocop:enable LineLength
|
58
|
+
|
55
59
|
#
|
56
60
|
# @return [Boolean] true if this is a data column
|
57
61
|
#
|
58
|
-
# @see
|
59
|
-
# http://www.datastax.com/documentation/cql/3.0/webhelp/index.html#cql/ddl/../../cassandra/glossary/gloss_glossary.html
|
60
|
-
# The CQL3 glossary
|
61
|
-
#
|
62
62
|
def data_column?
|
63
63
|
!key?
|
64
64
|
end
|
@@ -214,7 +214,8 @@ module Cequel
|
|
214
214
|
#
|
215
215
|
# A List column
|
216
216
|
#
|
217
|
-
# @see http://
|
217
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#list
|
218
|
+
# CQL documentation for the list type
|
218
219
|
#
|
219
220
|
class List < CollectionColumn
|
220
221
|
# (see Column#to_cql)
|
@@ -233,8 +234,7 @@ module Cequel
|
|
233
234
|
#
|
234
235
|
# A Set column
|
235
236
|
#
|
236
|
-
# @see
|
237
|
-
# http://www.datastax.com/documentation/cql/3.0/webhelp/index.html#cql/cql_using/use_collections_c.html#task_ds_agt_3kj_zj
|
237
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#set
|
238
238
|
# CQL documentation for set columns
|
239
239
|
#
|
240
240
|
class Set < CollectionColumn
|
@@ -256,7 +256,7 @@ module Cequel
|
|
256
256
|
# A Map column
|
257
257
|
#
|
258
258
|
# @see
|
259
|
-
# http://
|
259
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#map
|
260
260
|
# CQL documentation for map columns
|
261
261
|
#
|
262
262
|
class Map < CollectionColumn
|
@@ -28,7 +28,9 @@ module Cequel
|
|
28
28
|
# replicas that should exist for each piece of data
|
29
29
|
# @return [void]
|
30
30
|
#
|
31
|
-
# @see
|
31
|
+
# @see
|
32
|
+
# http://cassandra.apache.org/doc/cql3/CQL.html#createKeyspaceStmt
|
33
|
+
# CQL3 CREATE KEYSPACE documentation
|
32
34
|
#
|
33
35
|
def create!(options = {})
|
34
36
|
bare_connection =
|
@@ -54,7 +56,8 @@ module Cequel
|
|
54
56
|
#
|
55
57
|
# @return [void]
|
56
58
|
#
|
57
|
-
# @see
|
59
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#dropKeyspaceStmt
|
60
|
+
# CQL3 DROP KEYSPACE documentation
|
58
61
|
#
|
59
62
|
def drop!
|
60
63
|
keyspace.execute("DROP KEYSPACE #{keyspace.name}")
|
data/lib/cequel/schema/table.rb
CHANGED
@@ -166,7 +166,8 @@ module Cequel
|
|
166
166
|
# @return [void]
|
167
167
|
#
|
168
168
|
# @see STORAGE_PROPERTIES List of storage property names
|
169
|
-
# @see
|
169
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#createTableOptions
|
170
|
+
# list of CQL3 table storage properties
|
170
171
|
#
|
171
172
|
def add_property(name, value)
|
172
173
|
TableProperty.build(name, value).tap do |property|
|
data/lib/cequel/type.rb
CHANGED
@@ -160,7 +160,8 @@ module Cequel
|
|
160
160
|
#
|
161
161
|
# `ascii` columns store 7-bit ASCII character data
|
162
162
|
#
|
163
|
-
# @see
|
163
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
164
|
+
# CQL3 data type documentation
|
164
165
|
#
|
165
166
|
class Ascii < String
|
166
167
|
def compatible_types
|
@@ -179,7 +180,8 @@ module Cequel
|
|
179
180
|
# `blob` columns store arbitrary bytes of data, represented as 8-bit ASCII
|
180
181
|
# strings of hex digits
|
181
182
|
#
|
182
|
-
# @see
|
183
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
184
|
+
# CQL3 data type documentation
|
183
185
|
#
|
184
186
|
class Blob < String
|
185
187
|
def internal_names
|
@@ -202,7 +204,8 @@ module Cequel
|
|
202
204
|
#
|
203
205
|
# `boolean` types store boolean values
|
204
206
|
#
|
205
|
-
# @see
|
207
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
208
|
+
# CQL3 data type documentation
|
206
209
|
#
|
207
210
|
class Boolean < Base
|
208
211
|
def cast(value)
|
@@ -218,7 +221,8 @@ module Cequel
|
|
218
221
|
# counter columns cannot be updated without Cassandra internally reading
|
219
222
|
# the existing state of the column
|
220
223
|
#
|
221
|
-
# @see
|
224
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
225
|
+
# CQL3 data type documentation
|
222
226
|
#
|
223
227
|
class Counter < Base
|
224
228
|
def internal_names
|
@@ -238,7 +242,8 @@ module Cequel
|
|
238
242
|
#
|
239
243
|
# `decimal` columns store decimal numeric values
|
240
244
|
#
|
241
|
-
# @see
|
245
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
246
|
+
# CQL3 data type documentation
|
242
247
|
#
|
243
248
|
class Decimal < Base
|
244
249
|
def cast(value)
|
@@ -250,7 +255,8 @@ module Cequel
|
|
250
255
|
#
|
251
256
|
# `double` columns store 64-bit floating-point numeric values
|
252
257
|
#
|
253
|
-
# @see
|
258
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
259
|
+
# CQL3 data type documentation
|
254
260
|
#
|
255
261
|
class Double < Base
|
256
262
|
def cast(value)
|
@@ -260,9 +266,10 @@ module Cequel
|
|
260
266
|
register Double.instance
|
261
267
|
|
262
268
|
#
|
263
|
-
#
|
269
|
+
# `inet` columns store IP addresses
|
264
270
|
#
|
265
|
-
# @see
|
271
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
272
|
+
# CQL3 data type documentation
|
266
273
|
#
|
267
274
|
class Inet < Base
|
268
275
|
def internal_names
|
@@ -274,7 +281,8 @@ module Cequel
|
|
274
281
|
#
|
275
282
|
# `int` columns store 32-bit integer values
|
276
283
|
#
|
277
|
-
# @see
|
284
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
285
|
+
# CQL3 data type documentation
|
278
286
|
#
|
279
287
|
class Int < Base
|
280
288
|
def internal_names
|
@@ -290,7 +298,8 @@ module Cequel
|
|
290
298
|
#
|
291
299
|
# `float` columns store 32-bit floating-point numeric values
|
292
300
|
#
|
293
|
-
# @see
|
301
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
302
|
+
# CQL3 data type documentation
|
294
303
|
#
|
295
304
|
class Float < Double; end
|
296
305
|
register Float.instance
|
@@ -298,7 +307,8 @@ module Cequel
|
|
298
307
|
#
|
299
308
|
# `bigint` columns store 64-bit integer values
|
300
309
|
#
|
301
|
-
# @see
|
310
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
311
|
+
# CQL3 data type documentation
|
302
312
|
#
|
303
313
|
class Bigint < Int
|
304
314
|
def internal_names
|
@@ -312,7 +322,8 @@ module Cequel
|
|
312
322
|
# `varchar` columns; the names can be used interchangeably. Text columns do
|
313
323
|
# not have a length limit
|
314
324
|
#
|
315
|
-
# @see
|
325
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
326
|
+
# CQL3 data type documentation
|
316
327
|
#
|
317
328
|
class Text < String
|
318
329
|
def internal_names
|
@@ -335,6 +346,9 @@ module Cequel
|
|
335
346
|
# `timestamp` columns store timestamps. Timestamps do not include time zone
|
336
347
|
# data, and all input times are cast to UTC before being stored.
|
337
348
|
#
|
349
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#usingdates
|
350
|
+
# CQL3 documentation for date columns
|
351
|
+
#
|
338
352
|
class Timestamp < Base
|
339
353
|
def internal_names
|
340
354
|
['org.apache.cassandra.db.marshal.DateType',
|
@@ -357,6 +371,9 @@ module Cequel
|
|
357
371
|
# the underlying `cassandra-cql` library expects. Other UUID formats are
|
358
372
|
# supported as inputs.
|
359
373
|
#
|
374
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
375
|
+
# CQL3 data type documentation
|
376
|
+
#
|
360
377
|
class Uuid < Base
|
361
378
|
def internal_names
|
362
379
|
['org.apache.cassandra.db.marshal.UUIDType']
|
@@ -379,6 +396,9 @@ module Cequel
|
|
379
396
|
# functionality presumes the use of type 1 UUIDs, which encode the
|
380
397
|
# timestamp of their creation.
|
381
398
|
#
|
399
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
400
|
+
# CQL3 data type documentation
|
401
|
+
#
|
382
402
|
class Timeuuid < Uuid
|
383
403
|
def internal_names
|
384
404
|
['org.apache.cassandra.db.marshal.TimeUUIDType']
|
@@ -389,6 +409,9 @@ module Cequel
|
|
389
409
|
#
|
390
410
|
# `varint` columns store arbitrary-length integer data
|
391
411
|
#
|
412
|
+
# @see http://cassandra.apache.org/doc/cql3/CQL.html#types
|
413
|
+
# CQL3 data type documentation
|
414
|
+
#
|
392
415
|
class Varint < Int
|
393
416
|
def internal_name
|
394
417
|
'org.apache.cassandra.db.marshal.IntegerType'
|
data/lib/cequel/version.rb
CHANGED
data/templates/record.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
class <%= class_name %>
|
2
|
+
include Cequel::Record
|
3
|
+
|
4
|
+
key :id, :uuid, auto: true
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
column <%= attribute.name.to_sym.inspect %>, <%= attribute.type.to_sym.inspect %><% if attribute.has_index? %>, index: true<% end %>
|
7
|
+
<%- end -%>
|
8
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Brown
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-02-
|
15
|
+
date: 2014-02-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -186,6 +186,7 @@ files:
|
|
186
186
|
- lib/cequel/record/persistence.rb
|
187
187
|
- lib/cequel/record/properties.rb
|
188
188
|
- lib/cequel/record/railtie.rb
|
189
|
+
- lib/cequel/record/record_generator.rb
|
189
190
|
- lib/cequel/record/record_set.rb
|
190
191
|
- lib/cequel/record/schema.rb
|
191
192
|
- lib/cequel/record/scoped.rb
|
@@ -209,6 +210,7 @@ files:
|
|
209
210
|
- lib/cequel/util.rb
|
210
211
|
- lib/cequel/version.rb
|
211
212
|
- lib/cequel.rb
|
213
|
+
- templates/record.rb
|
212
214
|
- spec/environment.rb
|
213
215
|
- spec/examples/metal/data_set_spec.rb
|
214
216
|
- spec/examples/record/associations_spec.rb
|
@@ -252,9 +254,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
254
|
version: '1.9'
|
253
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
256
|
requirements:
|
255
|
-
- - '
|
257
|
+
- - '>='
|
256
258
|
- !ruby/object:Gem::Version
|
257
|
-
version:
|
259
|
+
version: '0'
|
258
260
|
requirements:
|
259
261
|
- Cassandra >= 1.2.0
|
260
262
|
rubyforge_project:
|