Class: DatastaxRails::Cql::ColumnFamily

Inherits:
Object
  • Object
show all
Defined in:
lib/datastax_rails/cql/column_family.rb

Overview

Helper class to create CQL-building objects

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ ColumnFamily

Returns a new instance of ColumnFamily


5
6
7
# File 'lib/datastax_rails/cql/column_family.rb', line 5

def initialize(klass)
  @klass = klass
end

Instance Method Details

#create_column_familyObject


9
10
11
# File 'lib/datastax_rails/cql/column_family.rb', line 9

def create_column_family
  DatastaxRails::Cql::CreateColumnFamily.new(@klass.column_family)
end

#delete(key) ⇒ Object


13
14
15
# File 'lib/datastax_rails/cql/column_family.rb', line 13

def delete(key)
  DatastaxRails::Cql::Delete.new(@klass, key)
end

#drop_column_familyObject


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

def drop_column_family
  DatastaxRails::Cql::DropColumnFamily.new(@klass.column_family)
end

#insertObject


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

def insert
  DatastaxRails::Cql::Insert.new(@klass)
end

#select(*columns) ⇒ Object


25
26
27
28
# File 'lib/datastax_rails/cql/column_family.rb', line 25

def select(*columns)
  columns << '*' if columns.empty?
  DatastaxRails::Cql::Select.new(@klass, columns.flatten)
end

#truncateObject


30
31
32
# File 'lib/datastax_rails/cql/column_family.rb', line 30

def truncate
  DatastaxRails::Cql::Truncate.new(@klass)
end

#update(key) ⇒ Object


34
35
36
# File 'lib/datastax_rails/cql/column_family.rb', line 34

def update(key)
  DatastaxRails::Cql::Update.new(@klass, key)
end