class Cequel::Record::Map
The value of a `map` column in a {Record} instance. Encapsulates and behaves like a built-in `Hash`.
@see cassandra.apache.org/doc/cql3/CQL.html#map
CQL documentation for map columns
@since 1.0.0
Constants
- NON_ATOMIC_MUTATORS
These methods involve mutation that cannot be expressed as a CQL operation, so are not implemented.
Public Instance Methods
Set
the value of a given key
@param key the key @param value the value @return [Map] self
# File lib/cequel/record/collection.rb, line 481 def []=(key, value) key = cast_key(key) to_update { updater.map_update(column_name, key => value) } to_modify { super } end
Remove all elements from this map. Equivalent to deleting the column value from the row in CQL
@return [Map] self
# File lib/cequel/record/collection.rb, line 494 def clear to_update { deleter.delete_columns(column_name) } to_modify { super } end
Delete one key from the map
@param key the key to delete @return [Map] self
# File lib/cequel/record/collection.rb, line 505 def delete(key) key = cast_key(key) to_update { deleter.map_remove(column_name, key) } to_modify { super } end
Update a collection of keys and values given by a hash
@param hash [Hash] hash containing keys and values to set @return [Map] self
# File lib/cequel/record/collection.rb, line 517 def merge!(hash) hash = cast_collection(hash) to_update { updater.map_update(column_name, hash) } to_modify { super } end
Replace the entire contents of this map with a new one
@param hash [Hash] hash containing new keys and values @return [Map] self
# File lib/cequel/record/collection.rb, line 530 def replace(hash) hash = cast_collection(hash) to_update { updater.set(column_name => hash) } to_modify { super } end