v0.6.2
What's new:
- feat: add push/pull if exists methods & constants to collection fields #37
Now for collection fields we get additional push/pull if exists constants and methods
#[charybdis_model(
table_name = users,
partition_keys = [id],
clustering_keys = []
)]
pub struct User {
id: Uuid,
tags: Set<Text>,
}
// constants
impl User {
const PUSH_TAGS_IF_EXISTS_QUERY: &'static str = "UPDATE users SET tags = tags + ? WHERE id = ? IF EXISTS";
const PULL_POST_IDS_IF_EXISTS_QUERY: &'static str = "UPDATE users SET post_ids = post_ids - ? WHERE id = ? IF EXISTS";
}
// methods
let user = User::new();
user.push_tags_if_exists(tags: HashSet<T>).execute(&session).await;
user.pull_tags_if_exists(tags: HashSet<T>).execute(&session).await;