Class: Cequel::Schema::List

Inherits:
CollectionColumn show all
Defined in:
lib/cequel/schema/column.rb

Overview

A List column

See Also:

Since:

  • 1.0.0

Instance Attribute Summary

Attributes inherited from Column

#name, #type

Instance Method Summary collapse

Methods inherited from CollectionColumn

#collection_column?, #indexed?

Methods inherited from Column

#==, #clustering_column?, #collection_column?, #data_column?, #indexed?, #initialize, #inspect, #key?, #partition_key?, #to_s, #type?

Constructor Details

This class inherits a constructor from Cequel::Schema::Column

Instance Method Details

#cast(value) ⇒ Array

Returns array with elements cast to correct type for column.

Returns:

  • (Array)

    array with elements cast to correct type for column

Since:

  • 1.0.0



240
241
242
# File 'lib/cequel/schema/column.rb', line 240

def cast(value)
  value.map { |element| @type.cast(element) }
end

#to_cqlString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a CQL fragment representing this column in a table definition.

Returns:

  • (String)

    a CQL fragment representing this column in a table definition

Since:

  • 1.0.0



233
234
235
# File 'lib/cequel/schema/column.rb', line 233

def to_cql
  "#{@name} LIST <#{@type}>"
end