Skip to content

Commit

Permalink
codegen: fix ColumnType to Rust type resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Aug 6, 2024
1 parent 7e433df commit 4ddb397
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sea-orm-codegen/src/entity/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ impl Column {
},
ColumnType::Timestamp => match date_time_crate {
DateTimeCrate::Chrono => "DateTimeUtc".to_owned(),
// ColumnType::Timpestamp(_) => time::PrimitiveDateTime: https://docs.rs/sqlx/0.3.5/sqlx/postgres/types/index.html#time
DateTimeCrate::Time => "TimeDateTime".to_owned(),
},
ColumnType::TimestampWithTimeZone => match date_time_crate {
Expand All @@ -77,6 +76,14 @@ impl Column {
ColumnType::Array(column_type) => {
format!("Vec<{}>", write_rs_type(column_type, date_time_crate))
}
ColumnType::Bit(None | Some(1)) => "bool".to_owned(),
ColumnType::Bit(_) | ColumnType::VarBit(_) => "Vec<u8>".to_owned(),
ColumnType::Year => "i32".to_owned(),
ColumnType::Interval(_, _)
| ColumnType::Cidr
| ColumnType::Inet
| ColumnType::MacAddr
| ColumnType::LTree => "String".to_owned(),
_ => unimplemented!(),
}
}
Expand Down

0 comments on commit 4ddb397

Please sign in to comment.