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:

  • clustering_order (:asc, :desc) (defaults to: nil)

    ascending or descending order for this column

  • name (Symbol)

    the name of the column

  • type (Type)

    the type of the column

Since:

  • 1.0.0



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

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:

  • (:asc, :desc)

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

Since:

  • 1.0.0



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

def clustering_order
  @clustering_order
end

Instance Method Details

#clustering_column?Boolean

Returns true if this is a clustering column.

Returns:

  • (Boolean)

    true if this is a clustering column

See Also:

Since:

  • 1.0.0



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

def clustering_column?
  true
end

#clustering_order_cqlObject

Since:

  • 1.0.0



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

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