diff --git a/Cargo.lock b/Cargo.lock index 83b019e..1c41e13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,10 +207,10 @@ dependencies = [ [[package]] name = "charybdis" -version = "0.5.1" +version = "0.5.2" dependencies = [ "bigdecimal", - "charybdis_macros 0.5.0", + "charybdis_macros 0.5.2", "chrono", "colored", "futures", @@ -223,9 +223,9 @@ dependencies = [ [[package]] name = "charybdis-migrate" -version = "0.5.0" +version = "0.5.2" dependencies = [ - "charybdis_parser 0.5.0", + "charybdis_parser 0.5.2", "clap", "colored", "regex", @@ -251,10 +251,10 @@ dependencies = [ [[package]] name = "charybdis_macros" -version = "0.5.0" +version = "0.5.2" dependencies = [ "charybdis 0.4.18", - "charybdis_parser 0.5.0", + "charybdis_parser 0.5.2", "darling", "proc-macro2", "quote", @@ -283,7 +283,7 @@ dependencies = [ [[package]] name = "charybdis_parser" -version = "0.5.0" +version = "0.5.2" dependencies = [ "colored", "darling", diff --git a/charybdis-macros/Cargo.toml b/charybdis-macros/Cargo.toml index 8f561f9..ba543e9 100644 --- a/charybdis-macros/Cargo.toml +++ b/charybdis-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "charybdis_macros" rust-version = "1.75.0" -version = "0.5.0" +version = "0.5.2" edition = "2021" description = "Proc macro crate for Charybdis ORM" repository = "https://github.com/nodecosmos/charybdis" @@ -12,7 +12,7 @@ categories = ["database"] proc-macro = true [dependencies] -charybdis_parser = { version = "0.5.0", path = "../charybdis-parser" } +charybdis_parser = { version = "0.5.2", path = "../charybdis-parser" } proc-macro2 = "1.0.79" syn = { version = "2.0.53", features = ["full"] } quote = "1.0.35" diff --git a/charybdis-migrate/Cargo.toml b/charybdis-migrate/Cargo.toml index c089ddb..2222f59 100644 --- a/charybdis-migrate/Cargo.toml +++ b/charybdis-migrate/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "charybdis-migrate" rust-version = "1.75.0" -version = "0.5.0" +version = "0.5.2" edition = "2021" description = "Automatic Migration Tool for Charybdis ORM" repository = "https://github.com/nodecosmos/charybdis" @@ -9,7 +9,7 @@ license = "MIT" categories = ["database"] [dependencies] -charybdis_parser = { version = "0.5.0", path = "../charybdis-parser" } +charybdis_parser = { version = "0.5.2", path = "../charybdis-parser" } scylla = "0.12.0" tokio = { version = "1.36.0", features = ["full"] } serde_json = "1.0.114" diff --git a/charybdis-parser/Cargo.toml b/charybdis-parser/Cargo.toml index 62eb887..0b611ae 100644 --- a/charybdis-parser/Cargo.toml +++ b/charybdis-parser/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "charybdis_parser" rust-version = "1.75.0" -version = "0.5.0" +version = "0.5.2" edition = "2021" description = "Parser crate for Charybdis ORM" repository = "https://github.com/nodecosmos/charybdis" diff --git a/charybdis-parser/src/fields.rs b/charybdis-parser/src/fields.rs index b5f0ce1..1d64af3 100644 --- a/charybdis-parser/src/fields.rs +++ b/charybdis-parser/src/fields.rs @@ -264,32 +264,28 @@ impl<'a> CharybdisFields<'a> { } if ch_field.is_partition_key { - partition_key_fields.insert( - *partition_key_indexes_by_name - .get(&ch_field.name) - .expect("index must be set"), - Some(ch_field), - ); - primary_key_fields.insert( - *primary_key_indexes_by_name - .get(&ch_field.name) - .expect("index must be set"), - Some(ch_field), - ); + let partition_key_index = *partition_key_indexes_by_name + .get(&ch_field.name) + .expect("index must be set"); + partition_key_fields[partition_key_index] = Some(ch_field); + + let primary_key_index = *primary_key_indexes_by_name + .get(&ch_field.name) + .expect("index must be set"); + primary_key_fields[primary_key_index] = Some(ch_field); + pk_struct_fields.insert(ch_field.name.clone()); } else if ch_field.is_clustering_key { - clustering_key_fields.insert( - *clustering_key_indexes_by_name - .get(&ch_field.name) - .expect("index must be set"), - Some(ch_field), - ); - primary_key_fields.insert( - *primary_key_indexes_by_name - .get(&ch_field.name) - .expect("index must be set"), - Some(ch_field), - ); + let clustering_key_index = *clustering_key_indexes_by_name + .get(&ch_field.name) + .expect("index must be set"); + clustering_key_fields[clustering_key_index] = Some(ch_field); + + let primary_key_index = *primary_key_indexes_by_name + .get(&ch_field.name) + .expect("index must be set"); + primary_key_fields[primary_key_index] = Some(ch_field); + ck_struct_fields.insert(ch_field.name.clone()); } } diff --git a/charybdis-parser/src/traits.rs b/charybdis-parser/src/traits.rs index 6e435e0..1a162b7 100644 --- a/charybdis-parser/src/traits.rs +++ b/charybdis-parser/src/traits.rs @@ -56,9 +56,7 @@ impl CharybdisMacroArgs { } pub fn primary_key(&self) -> Vec<&String> { - let primary_key = self.partition_keys().iter().chain(self.clustering_keys()); - - primary_key.collect() + self.partition_keys().iter().chain(self.clustering_keys()).collect() } } diff --git a/charybdis/Cargo.toml b/charybdis/Cargo.toml index 5dfdb10..f291479 100644 --- a/charybdis/Cargo.toml +++ b/charybdis/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "charybdis" rust-version = "1.75.0" -version = "0.5.1" +version = "0.5.2" edition = "2021" description = "High-Performance ORM for ScyllaDB" repository = "https://github.com/nodecosmos/charybdis" @@ -11,7 +11,7 @@ categories = ["database"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -charybdis_macros = { version = "0.5.0", path = "../charybdis-macros" } +charybdis_macros = { version = "0.5.2", path = "../charybdis-macros" } chrono = { version = "0.4.35", features = ["serde"] } futures = "0.3.30" num-bigint = "0.4.4"