Skip to content

Commit

Permalink
feat: cast bigint and decimal types to number
Browse files Browse the repository at this point in the history
  • Loading branch information
xsadia committed Nov 11, 2024
1 parent d2a922d commit f7e981e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/code_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,15 @@ fn create_mapper(model: &Model) -> String {

for field in &model.fields {
if get_field_with_type(field, false).is_some() {
write!(mapper, "\n\t\t\t{}: data.{},", field.name, field.name).unwrap();
match field.field_type.as_str() {
"Decimal" | "BigInt" => write!(
mapper,
"\n\t\t\t{}: Number(data.{}),",
field.name, field.name
)
.unwrap(),
_ => write!(mapper, "\n\t\t\t{}: data.{},", field.name, field.name).unwrap(),
}
}
}

Expand Down

0 comments on commit f7e981e

Please sign in to comment.