Class: DatastaxRails::Cql::CreateIndex

Inherits:
Base show all
Defined in:
lib/datastax_rails/cql/create_index.rb

Overview

CQL generation for CREATE INDEX

Instance Method Summary collapse

Methods inherited from Base

#execute, #using

Constructor Details

#initialize(index_name = nil) ⇒ CreateIndex


5
6
7
8
9
# File 'lib/datastax_rails/cql/create_index.rb', line 5

def initialize(index_name = nil)
  @cf_name = nil
  @column = nil
  @index_name = index_name
end

Instance Method Details

#column(column) ⇒ Object


16
17
18
19
# File 'lib/datastax_rails/cql/create_index.rb', line 16

def column(column)
  @column = column
  self
end

#on(cf_name) ⇒ Object


11
12
13
14
# File 'lib/datastax_rails/cql/create_index.rb', line 11

def on(cf_name)
  @cf_name = cf_name
  self
end

#to_cqlObject


21
22
23
# File 'lib/datastax_rails/cql/create_index.rb', line 21

def to_cql
  "CREATE INDEX #{@index_name} ON #{@cf_name} (#{@column})"
end