Skip to content

Commit

Permalink
Merge pull request #1100 from Lorak-mmk/doc-counter-examples
Browse files Browse the repository at this point in the history
docs: Add Counter UPDATE example
  • Loading branch information
Lorak-mmk authored Oct 24, 2024
2 parents 025342c + 187f89d commit aef0cf5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/source/data-types/counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
use futures::TryStreamExt;
use scylla::frame::value::Counter;

// Add to counter value
let to_add: Counter = Counter(100);
session
.query_unpaged("UPDATE keyspace.table SET c = c + ? WHERE pk = 15", (to_add,))
.await?;

// Read counter from the table
let mut iter = session.query_iter("SELECT c FROM keyspace.table", &[])
.await?
Expand Down

0 comments on commit aef0cf5

Please sign in to comment.