class QueryBuilder::CQL::Contexts::Table

Describes the Cassandra table

Public Instance Methods

alter(options) click to toggle source

Builds the ‘ALTER TABLE’ CQL statement to modify properties (WITH)

@param [Hash] options

@return [QueryBuilder::Statements::AlterTable]

# File lib/query_builder/cql/contexts/table.rb, line 76
def alter(options)
  Statements::AlterTable.new(context: self).alter(options)
end
column(name) click to toggle source

Returns the column context

@param [#to_s] name

@return [QueryBuilder::CQL::Contexts::Column]

# File lib/query_builder/cql/contexts/table.rb, line 48
def column(name)
  Column.new(table: self, name: name)
end
create() click to toggle source

Builds the ‘CREATE TABLE’ CQL statement

@return [QueryBuilder::Statements::CreateTable]

# File lib/query_builder/cql/contexts/table.rb, line 66
def create
  Statements::CreateTable.new(context: self)
end
delete(*columns) click to toggle source

Builds the ‘DELETE’ CQL statement

@param [Array<#to_s>, to_s, nil] columns

@return [QueryBuilder::Statements::Delete]

# File lib/query_builder/cql/contexts/table.rb, line 124
def delete(*columns)
  Statements::Delete.new(context: self).delete(*columns)
end
drop() click to toggle source

Builds the ‘DROP TABLE’ CQL statement

@return [QueryBuilder::Statements::DropTable]

# File lib/query_builder/cql/contexts/table.rb, line 84
def drop
  Statements::DropTable.new(context: self)
end
index(name = nil) click to toggle source

Returns the index context

@param [#to_s] name

@return [QueryBuilder::CQL::Contexts::Index]

# File lib/query_builder/cql/contexts/table.rb, line 28
def index(name = nil)
  Index.new(table: self, name: name)
end
insert(options = {}) click to toggle source

Builds the ‘INSERT’ CQL statement

@param [Hash] options

@return [QueryBuilder::Statements::Insert]

# File lib/query_builder/cql/contexts/table.rb, line 94
def insert(options = {})
  Statements::Insert.new(context: self).insert(options)
end
permission(name = nil) click to toggle source

Returns the context of Cassandra table permission

@param [#to_s, nil] name The name of the permission

@param [QueryBuilder::CQL::Contexts::Permission]

# File lib/query_builder/cql/contexts/table.rb, line 58
def permission(name = nil)
  Contexts::Permission.new(table: self, name: name)
end
select(*values) click to toggle source

Builds the ‘SELECT’ CQL statement

@param [Array<#to_s>, Hash, nil] values

@return [QueryBuilder::Statements::Insert]

# File lib/query_builder/cql/contexts/table.rb, line 104
def select(*values)
  Statements::Select.new(context: self).select(*values)
end
to_s() click to toggle source

Returns the full name of the table

@return [String]

# File lib/query_builder/cql/contexts/table.rb, line 18
def to_s
  [keyspace, name].join(".")
end
trigger(name) click to toggle source

Returns the trigger context

@param [#to_s] name

@return [QueryBuilder::CQL::Contexts::Trigger]

# File lib/query_builder/cql/contexts/table.rb, line 38
def trigger(name)
  Trigger.new(table: self, name: name)
end
truncate() click to toggle source

Builds the ‘TRUNCATE’ CQL statement

@return [QueryBuilder::Statements::Truncate]

# File lib/query_builder/cql/contexts/table.rb, line 132
def truncate
  Statements::Truncate.new(context: self)
end
update(options = {}) click to toggle source

Builds the ‘UPDATE’ CQL statement

@param [Hash] options

@return [QueryBuilder::Statements::Update]

# File lib/query_builder/cql/contexts/table.rb, line 114
def update(options = {})
  Statements::Update.new(context: self).update(options)
end