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?, #indexed?, #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


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

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


156
157
158
# File 'lib/cequel/schema/column.rb', line 156

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


171
172
173
# File 'lib/cequel/schema/column.rb', line 171

def clustering_column?
  true
end

#clustering_order_cqlObject

Since:

  • 1.0.0


176
177
178
# File 'lib/cequel/schema/column.rb', line 176

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