Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion codegen/src/worktable/generator/queries/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ impl Generator {
let name_generator = WorktableNameGenerator::from_table_name(self.name.to_string());
let avt_type_ident = name_generator.get_available_type_ident();

let rows: Vec<_> = self
let unique_types: std::collections::HashSet<String> = self
.columns
.indexes
.iter()
.filter_map(|(_, idx)| self.columns.columns_map.get(&idx.field))
.map(|ty| ty.to_string())
.collect();

let rows: Vec<_> = unique_types
.iter()
.map(|s| {
let type_ident = Ident::new(s.to_string().as_str(), Span::mixed_site());
let type_upper =
Expand Down
3 changes: 3 additions & 0 deletions examples/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ fn main() {
attr: String,
attr2: i16,
attr_float: f64,
attr_string: String,

},
indexes: {
idx1: attr,
idx2: attr2,
idx3: attr_string,
},
queries: {
update: {
Expand All @@ -43,6 +45,7 @@ fn main() {
test: 1,
id: 0,
attr_float: 100.0,
attr_string: "String_attr".to_string(),
};

// insert
Expand Down
Loading