Skip to content

Commit a1ea114

Browse files
authored
Fix bug when persisted tables code did not compiled with optional fields (#135)
1 parent c7e9bf2 commit a1ea114

6 files changed

Lines changed: 1171 additions & 3 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["codegen", "examples", "performance_measurement", "performance_measur
33

44
[package]
55
name = "worktable"
6-
version = "0.8.17"
6+
version = "0.8.18"
77
edition = "2024"
88
authors = ["Handy-caT"]
99
license = "MIT"
@@ -16,7 +16,7 @@ perf_measurements = ["dep:performance_measurement", "dep:performance_measurement
1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
worktable_codegen = { path = "codegen", version = "=0.8.14" }
19+
worktable_codegen = { path = "codegen", version = "=0.8.18" }
2020

2121
eyre = "0.6.12"
2222
derive_more = { version = "2.0.1", features = ["from", "error", "display", "into"] }

codegen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "worktable_codegen"
3-
version = "0.8.14"
3+
version = "0.8.18"
44
edition = "2024"
55
license = "MIT"
66
description = "WorkTable codegeneration crate"

codegen/src/worktable/generator/queries/type.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ pub fn map_to_uppercase(str: &str) -> String {
1515
.expect("OrderedFloat def contains inner type")
1616
.replace(">", "");
1717
format!("Ordered{}", inner_type.to_uppercase().trim())
18+
} else if str.contains("Option") {
19+
let mut split = str.split("<");
20+
let _ = split.next();
21+
let inner_type = split
22+
.next()
23+
.expect("Option def contains inner type")
24+
.replace(">", "");
25+
format!("Option{}", inner_type.to_uppercase().trim())
1826
} else {
1927
str.to_uppercase()
2028
}

tests/persistence/sync/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use worktable::prelude::*;
55
use worktable::worktable;
66

77
mod many_strings;
8+
mod option;
89
mod string_primary_index;
910
mod string_re_read;
1011
mod string_secondary_index;

0 commit comments

Comments
 (0)