class Cequel::Record::Set
The value of a set column in a {Record} instance. Contains an unordered, unique set of elements. Encapsulates and behaves like the `Set` type from the standard library.
@see cassandra.apache.org/doc/cql3/CQL.html#set
CQL documentation for set columns
@since 1.0.0
Constants
- NON_ATOMIC_MUTATORS
These methods are not implemented because they cannot be expressed as a single CQL3 write operation.
Public Instance Methods
add(object)
click to toggle source
Add an element to the set
@param object element to add @return [Set] self
Calls superclass method
# File lib/cequel/record/collection.rb, line 393 def add(object) object = cast_element(object) to_update { updater.set_add(column_name, object) } to_modify { super } end
Also aliased as: <<
clear()
click to toggle source
Remove everything from the set. Equivalent to deleting the collection column from the record's row.
@return [Set] self
Calls superclass method
# File lib/cequel/record/collection.rb, line 406 def clear to_update { deleter.delete_columns(column_name) } to_modify { super } end
delete(object)
click to toggle source
Remove a single element from the set
@param object element to remove @return [Set] self
Calls superclass method
# File lib/cequel/record/collection.rb, line 417 def delete(object) object = cast_element(object) to_update { updater.set_remove(column_name, object) } to_modify { super } end
replace(set)
click to toggle source
Replace the entire contents of this set with another set
@param set [::Set] set containing new elements @return [Set] self
Calls superclass method
# File lib/cequel/record/collection.rb, line 429 def replace(set) set = cast_collection(set) to_update { updater.set(column_name => set) } to_modify { super } end