Rust ORM for ScyllaDB and Apache Cassandra
MIT License
Bot releases are visible (Hide)
Published by GoranBrkuljan 7 months ago
maybe_find
methods & functions for optional single model queries (https://github.com/nodecosmos/charybdis/commit/ac1e013c6d66dbfc673d2d99d5923a667ca1fb8a)
maybe_find_by_primary_key
maybe_find_by_primary_key_value
maybe_find_first
let user = User::new();
user.maybe_find_by_primary_key().execute(db_session).await -> Result<Option<Model>, CharybdisError>
Published by GoranBrkuljan 8 months ago
Published by GoranBrkuljan 8 months ago
local_secondary_indexes
are now defined as list of fields. Partition key is derived from partition_keys
part of macro declaration and each element in array will result with new local index so now we just do:
#[charybdis_model(
table_name = menus,
partition_keys = [location],
clustering_keys = [name, price, dish_type],
global_secondary_indexes = [],
local_secondary_indexes = [dish_type]
)]
Published by GoranBrkuljan 8 months ago
.rs
files in charybdis-migrate
Published by GoranBrkuljan 8 months ago
All Operations: find
, insert
, update
, delete
now return CharybdisQuery
that can be configured before execution.
let user = user.find_by_primary_key().consistency(Consistency::One).execute(session);
Macro generated operations also return CharybdisQuery so instead of:
User::find_by_id(session, id).await?;
we have configurable:
User::find_by_id(id).consistency(Consistency::All).execute(db_sesison).await?;
Callbacks: We now have only single Callbacks
trait that is used for all operation that can accept extension.
In case extension is not needed, we can use blank ()
.
Batch Operations: Batch is now coupled with Model and it's created by calling Model::batch()
method. It
can also be configured before execution.
let batch = User::batch().consistency(Consistency::One).chunked_insert(&session, users, 100).await?;
Counter: Now we have macro-generated increment_<field_name>
and decrement_<field_name>
model methods to update counter fields.
Published by GoranBrkuljan 8 months ago
Published by GoranBrkuljan 9 months ago
--drop-and-replace
flag in migrate
so one can drop and replace column on type change