Class: Cql::Client::ColumnMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/cql/client/column_metadata.rb

Overview

Represents metadata about a column in a query result set or prepared statement. Apart from the keyspace, table and column names there's also the type as a symbol (e.g. :varchar, :int, :date).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#column_nameObject (readonly)

Returns the value of attribute column_name


9
10
11
# File 'lib/cql/client/column_metadata.rb', line 9

def column_name
  @column_name
end

#keyspaceObject (readonly)

Returns the value of attribute keyspace


9
10
11
# File 'lib/cql/client/column_metadata.rb', line 9

def keyspace
  @keyspace
end

#tableObject (readonly)

Returns the value of attribute table


9
10
11
# File 'lib/cql/client/column_metadata.rb', line 9

def table
  @table
end

#typeObject (readonly)

Returns the value of attribute type


9
10
11
# File 'lib/cql/client/column_metadata.rb', line 9

def type
  @type
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)

21
22
23
# File 'lib/cql/client/column_metadata.rb', line 21

def eql?(other)
  self.keyspace == other.keyspace && self.table == other.table && self.column_name == other.column_name && self.type == other.type
end

#hashObject


26
27
28
29
30
31
32
33
34
35
# File 'lib/cql/client/column_metadata.rb', line 26

def hash
  @h ||= begin
    h = 0
    h = ((h & 33554431) * 31) ^ @keyspace.hash
    h = ((h & 33554431) * 31) ^ @table.hash
    h = ((h & 33554431) * 31) ^ @column_name.hash
    h = ((h & 33554431) * 31) ^ @type.hash
    h
  end
end