Class: Cequel::Schema::Set

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

Overview

A Set 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?, #initialize, #inspect, #key?, #partition_key?, #to_s, #type?

Constructor Details

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

Instance Method Details

#cast(value) ⇒ ::Set

Returns set with elements cast to correct type for column.

Parameters:

  • value

    the value to cast

Returns:

  • (::Set)

    set with elements cast to correct type for column

Since:

  • 1.0.0



251
252
253
# File 'lib/cequel/schema/column.rb', line 251

def cast(value)
  value.to_set { |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



243
244
245
# File 'lib/cequel/schema/column.rb', line 243

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