Skip to content

Commit

Permalink
Add support for multiranges
Browse files Browse the repository at this point in the history
  • Loading branch information
jkosh44 committed Nov 21, 2022
1 parent 664345f commit f413e66
Show file tree
Hide file tree
Showing 3 changed files with 971 additions and 456 deletions.
15 changes: 14 additions & 1 deletion codegen/src/type_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ fn parse_types() -> BTreeMap<u32, Type> {
)
})
.collect::<HashMap<_, _>>();
let multi_range_elements = raw_ranges
.iter()
.map(|m| {
(
oids_by_name[&*m["rngmultitypid"]],
oids_by_name[&*m["rngsubtype"]],
)
})
.collect::<HashMap<_, _>>();

let range_vector_re = Regex::new("(range|vector)$").unwrap();
let array_re = Regex::new("^_(.*)").unwrap();
Expand All @@ -209,7 +218,11 @@ fn parse_types() -> BTreeMap<u32, Type> {
}

let element = match &*kind {
"R" => range_elements[&oid],
"R" => match &*raw_type["typtype"] {
"r" => range_elements[&oid],
"m" => multi_range_elements[&oid],
typtype => panic!("invalid range typtype {}", typtype),
}
"A" => oids_by_name[&raw_type["typelem"]],
_ => 0,
};
Expand Down
Loading

0 comments on commit f413e66

Please sign in to comment.