Menu

Counter

Counter is represented as struct Counter(pub i64)Counter can’t be inserted, it can only be read or updated.


use scylla::IntoTypedRows;
use scylla::frame::value::Counter;

// Read counter from the table
if let Some(rows) = session.query("SELECT c FROM keyspace.table", &[]).await?.rows {
    for row in rows.into_typed::<(Counter,)>() {
        let (counter_value,): (Counter,) = row?;
        let counter_int_value: i64 = counter_value.0;
    }
}