-
Notifications
You must be signed in to change notification settings - Fork 186
Collection operators
Flavian Alexandru edited this page May 30, 2016
·
6 revisions
Based on the above list of columns, phantom supports CQL 3 modify operations for CQL 3 collections: list, set, map
.
All operators will be available in an update query, specifically:
db.table.update
.where(_.id eqs someId)
.modify(_.someList $OPERATOR $args)
.future()
Examples in ListOperatorsTest.scala.
Name | Description |
---|---|
prepend |
Adds an item to the head of the list |
prependAll |
Adds multiple items to the head of the list |
append |
Adds an item to the tail of the list |
appendAll |
Adds multiple items to the tail of the list |
discard |
Removes the given item from the list. |
discardAll |
Removes all given items from the list. |
setIdIx |
Updates a specific index in the list |
Sets have a better performance than lists, as the Cassandra documentation suggests. Examples in SetOperationsTest.scala.
Name | Description |
---|---|
add |
Adds an item to the tail of the set |
addAll |
Adds multiple items to the tail of the set |
remove |
Removes the given item from the set. |
removeAll |
Removes all given items from the set. |
Both the key and value types of a Map must be Cassandra primitives. Examples in MapOperationsTest.scala:
Name | Description |
---|---|
put |
Adds an (key -> value) pair to the map |
putAll |
Adds multiple (key -> value) pairs to the map |
setTo |
Updates the value of a key in map, with Database.table.update.where(_.id eqs id).modify(_.map(key) setTo value).future()
|
To stay up-to-date with our latest releases and news, follow us on Twitter: @outworkers.
- Issues and questions
- Adopters
- Roadmap
- Changelog
- Tutorials
- Commercial support
- Using phantom in your project
- Primitive columns
- Optional primitive columns
- Collection columns
- Collection operators
- Automated schema generation
- Indexing columns
- Data modeling with phantom
- Querying with phantom
- Asynchronous iterators
- Batch statements
- Apache Thrift integration
- Apache ZooKeeper integration
- The phantom testkit