Class: Cequel::Schema::ClusteringColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/cequel/schema/column.rb

Overview

A clustering column

Since:

  • 1.0.0

Instance Attribute Summary collapse

Attributes inherited from Column

#name, #type

Instance Method Summary collapse

Methods inherited from Column

#==, #cast, #collection_column?, #data_column?, #inspect, #key?, #partition_key?, #to_cql, #to_s, #type?

Constructor Details

#initialize(name, type, clustering_order = nil) ⇒ ClusteringColumn

Returns a new instance of ClusteringColumn.

Parameters:

  • (defaults to: nil)

    ascending or descending order for this column

  • the name of the column

  • the type of the column

Since:

  • 1.0.0



153
154
155
156
# File 'lib/cequel/schema/column.rb', line 153

def initialize(name, type, clustering_order = nil)
  super(name, type)
  @clustering_order = (clustering_order || :asc).to_sym
end

Instance Attribute Details

#clustering_order ⇒ :asc, :desc (readonly)

Returns whether rows are ordered by ascending or descending values in this column.

Returns:

  • whether rows are ordered by ascending or descending values in this column

Since:

  • 1.0.0



146
147
148
# File 'lib/cequel/schema/column.rb', line 146

def clustering_order
  @clustering_order
end

Instance Method Details

#clustering_column? ⇒ Boolean

Returns true if this is a clustering column.

Returns:

  • true if this is a clustering column

See Also:

Since:

  • 1.0.0



161
162
163
# File 'lib/cequel/schema/column.rb', line 161

def clustering_column?
  true
end

#clustering_order_cql ⇒ Object

Since:

  • 1.0.0



166
167
168
# File 'lib/cequel/schema/column.rb', line 166

def clustering_order_cql
  "#{@name} #{@clustering_order}"
end