Class: Cassandra::ColumnContainer
- Inherits:
-
Object
- Object
- Cassandra::ColumnContainer
- Defined in:
- lib/cassandra/column_container.rb
Overview
This class contains all the logic needed for manipulating columns of an object.
Direct Known Subclasses
Defined Under Namespace
Classes: Compaction, Options
Instance Attribute Summary collapse
-
#clustering_columns ⇒ Array<Cassandra::Column>
readonly
Ordered list of column-names that make up the clustering-columns.
-
#id ⇒ Cassandra::Uuid
readonly
The id of this object in Cassandra.
-
#keyspace ⇒ Cassandra::Keyspace
readonly
The keyspace that this column-container belongs to.
-
#name ⇒ String
readonly
Name of this column-container.
-
#options ⇒ ColumnContainer::Options
readonly
Collection of configuration options of this column-container.
-
#partition_key ⇒ Array<Cassandra::Column>
readonly
Ordered list of column-names that make up the partition-key.
-
#primary_key ⇒ Array<Cassandra::Column>
readonly
Primary key of this column-container.
Instance Method Summary collapse
-
#column(name) ⇒ Cassandra::Column?
A column or nil.
-
#each_column(&block) ⇒ Object
(also: #columns)
Yield or enumerate each column defined in this column-container.
-
#has_column?(name) ⇒ Boolean
Whether this column-container has a given column.
Instance Attribute Details
#clustering_columns ⇒ Array<Cassandra::Column> (readonly)
230 231 232 |
# File 'lib/cassandra/column_container.rb', line 230 def clustering_columns @clustering_columns end |
#id ⇒ Cassandra::Uuid (readonly)
222 223 224 |
# File 'lib/cassandra/column_container.rb', line 222 def id @id end |
#keyspace ⇒ Cassandra::Keyspace (readonly)
224 225 226 |
# File 'lib/cassandra/column_container.rb', line 224 def keyspace @keyspace end |
#name ⇒ String (readonly)
220 221 222 |
# File 'lib/cassandra/column_container.rb', line 220 def name @name end |
#options ⇒ ColumnContainer::Options (readonly)
226 227 228 |
# File 'lib/cassandra/column_container.rb', line 226 def end |
#partition_key ⇒ Array<Cassandra::Column> (readonly)
228 229 230 |
# File 'lib/cassandra/column_container.rb', line 228 def partition_key @partition_key end |
#primary_key ⇒ Array<Cassandra::Column> (readonly)
This composition produces a flat list, so it will not be possible for the caller to distinguish partition-key columns from clustering-columns.
Returns primary key of this column-container. It's the combination of
partition_key
and clustering_columns
.
235 236 237 |
# File 'lib/cassandra/column_container.rb', line 235 def primary_key @primary_key end |
Instance Method Details
#column(name) ⇒ Cassandra::Column?
272 273 274 |
# File 'lib/cassandra/column_container.rb', line 272 def column(name) @columns_hash[name] end |
#each_column {|column| ... } ⇒ Cassandra::ColumnContainer #each_column ⇒ Array<Cassandra::Column> Also known as: columns
Yield or enumerate each column defined in this column-container
282 283 284 285 286 287 288 289 |
# File 'lib/cassandra/column_container.rb', line 282 def each_column(&block) if block_given? @columns.each(&block) self else @columns end end |
#has_column?(name) ⇒ Boolean
266 267 268 |
# File 'lib/cassandra/column_container.rb', line 266 def has_column?(name) @columns_hash.key?(name) end |