Skip to content

Commit

Permalink
Merge pull request #29 from nodecosmos/fix_field_order
Browse files Browse the repository at this point in the history
fix: field order requirement
  • Loading branch information
GoranBrkuljan authored Apr 26, 2024
2 parents 7acf2e7 + 67e20ca commit 8ce7a5b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 41 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions charybdis-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions charybdis-migrate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[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"
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"
Expand Down
2 changes: 1 addition & 1 deletion charybdis-parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
44 changes: 20 additions & 24 deletions charybdis-parser/src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
4 changes: 1 addition & 3 deletions charybdis-parser/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
4 changes: 2 additions & 2 deletions charybdis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 8ce7a5b

Please sign in to comment.