Added to keep the API consistent.
Added to keep the API consistent. It is not possible to add single elements to a set in Cassandra, the only CQL level support is for collections, even if they are collections of a single element. This is a nicety added by the phantom API, and we do a prepared variant to match with the above.
However, there's a known and important limitation, where the com.outworkers.phantom.macros.BindHelper macro is going to rely on the Primitive for the bound value to perform serialization. For this reason, we need to make sure the primitive used to serialize the bound value is a collection primitive, otherwise Cassandra will process an invalid update, where instead of treating the payload we send as a collection of a single element, it gets confused and actually irreversibly damages the contents of the buffer where the collection is stored.
This is because the binary payloads sent to Cassandra when a prepared statement is executed don't appear to be validated against any kind of schema and are instead processed blindly.
The prepared statement mark.
A prepared update statement expecting a set of elements to be bound. !! Important !!
Adds a single element to a Set collection.
Adds a single element to a Set collection. Note, this is a Phantom API nice to have, but it is not a feature directly supported by Cassandra, as Cassandra only supports adding sets to set collections. Here we simply add a set of one element.
The value to add to the set
An non-prepared update query.
Added to keep the API consistent.
Added to keep the API consistent. It is not possible to remove single elements from a set in Cassandra, the only CQL level support is for collections, even if they are collections of a single element. This is a nicety added by the phantom API, and we do a prepared variant to match with the above.
However, there's a known and important limitation, where the com.outworkers.phantom.macros.BindHelper macro is going to rely on the Primitive for the bound value to perform serialization. For this reason, we need to make sure the primitive used to serialize the bound value is a collection primitive, otherwise Cassandra will process an invalid update, where instead of treating the payload we send as a collection of a single element, it gets confused and actually irreversibly damages the contents of the buffer where the collection is stored.
This is because the binary payloads sent to Cassandra when a prepared statement is executed don't appear to be validated against any kind of schema and are instead processed blindly.
The prepared statement mark.
A prepared update statement expecting a set of elements to be bound. !! Important !!
Removes a single element from a Set collection.
Removes a single element from a Set collection. Note, this is a Phantom API nice to have, but it is not a feature directly supported by Cassandra, as Cassandra only supports removing entire sets from set collections. Here we simply remove a set of one element.
The value to add to the set
An non-prepared update query.