Class: QueryBuilder::CQL::Contexts::Column

Inherits:
Base
  • Object
show all
Defined in:
lib/query_builder/cql/contexts/column.rb

Overview

Describes the Cassandra table column

Instance Method Summary collapse

Instance Method Details

#alter(type) ⇒ QueryBuilder::Statements::AlterColumn

Builds the ‘ALTER TABLE … ALTER’ CQL statement

Parameters:

  • type (#to_s)

Returns:

  • (QueryBuilder::Statements::AlterColumn)


43
44
45
# File 'lib/query_builder/cql/contexts/column.rb', line 43

def alter(type)
  Statements::AlterColumn.new(context: self, type: type)
end

#create(type, options = {}) ⇒ QueryBuilder::Statements::AddColumn

Builds the ‘ALTER TABLE … ADD’ CQL statement

Parameters:

  • type (#to_s)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :static (Boolean)

Returns:

  • (QueryBuilder::Statements::AddColumn)


22
23
24
25
# File 'lib/query_builder/cql/contexts/column.rb', line 22

def create(type, options = {})
  Statements::CreateColumn
    .new(context: self, type: type, static: options[:static])
end

#dropQueryBuilder::Statements::DropColumn

Builds the ‘ALTER TABLE … DROP’ CQL statement

Returns:

  • (QueryBuilder::Statements::DropColumn)


51
52
53
# File 'lib/query_builder/cql/contexts/column.rb', line 51

def drop
  Statements::DropColumn.new(context: self)
end

#rename(name) ⇒ QueryBuilder::Statements::RenameColumn

Builds the ‘ALTER TABLE … RENAME’ CQL statement

Parameters:

  • name (#to_s)

Returns:

  • (QueryBuilder::Statements::RenameColumn)


33
34
35
# File 'lib/query_builder/cql/contexts/column.rb', line 33

def rename(name)
  Statements::RenameColumn.new(context: self, name: name)
end