Skip to content

Commit

Permalink
Add ipnetwork support for codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo1003 committed Oct 25, 2024
1 parent df45da1 commit e099f56
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sea-orm-codegen/src/entity/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ impl Column {
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(),
ColumnType::Cidr | ColumnType::Inet => "IpNetwork".to_owned(),
ColumnType::Interval(_, _) | ColumnType::MacAddr | ColumnType::LTree => {
"String".to_owned()
}
_ => unimplemented!(),
}
}
Expand Down Expand Up @@ -112,6 +111,7 @@ impl Column {
StringLen::Max => Some("VarBinary(StringLen::Max)".to_owned()),
},
ColumnType::Blob => Some("Blob".to_owned()),
ColumnType::Cidr => Some("Cidr".to_owned()),
_ => None,
};
col_type.map(|ty| quote! { column_type = #ty })
Expand Down Expand Up @@ -168,6 +168,8 @@ impl Column {
ColumnType::Json => quote! { ColumnType::Json },
ColumnType::JsonBinary => quote! { ColumnType::JsonBinary },
ColumnType::Uuid => quote! { ColumnType::Uuid },
ColumnType::Cidr => quote! { ColumnType::Cidr },
ColumnType::Inet => quote! { ColumnType::Inet },
ColumnType::Custom(s) => {
let s = s.to_string();
quote! { ColumnType::custom(#s) }
Expand Down

0 comments on commit e099f56

Please sign in to comment.