Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e099f56

Browse files
committedOct 25, 2024
Add ipnetwork support for codegen
1 parent df45da1 commit e099f56

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎sea-orm-codegen/src/entity/column.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ impl Column {
7979
ColumnType::Bit(None | Some(1)) => "bool".to_owned(),
8080
ColumnType::Bit(_) | ColumnType::VarBit(_) => "Vec<u8>".to_owned(),
8181
ColumnType::Year => "i32".to_owned(),
82-
ColumnType::Interval(_, _)
83-
| ColumnType::Cidr
84-
| ColumnType::Inet
85-
| ColumnType::MacAddr
86-
| ColumnType::LTree => "String".to_owned(),
82+
ColumnType::Cidr | ColumnType::Inet => "IpNetwork".to_owned(),
83+
ColumnType::Interval(_, _) | ColumnType::MacAddr | ColumnType::LTree => {
84+
"String".to_owned()
85+
}
8786
_ => unimplemented!(),
8887
}
8988
}
@@ -112,6 +111,7 @@ impl Column {
112111
StringLen::Max => Some("VarBinary(StringLen::Max)".to_owned()),
113112
},
114113
ColumnType::Blob => Some("Blob".to_owned()),
114+
ColumnType::Cidr => Some("Cidr".to_owned()),
115115
_ => None,
116116
};
117117
col_type.map(|ty| quote! { column_type = #ty })
@@ -168,6 +168,8 @@ impl Column {
168168
ColumnType::Json => quote! { ColumnType::Json },
169169
ColumnType::JsonBinary => quote! { ColumnType::JsonBinary },
170170
ColumnType::Uuid => quote! { ColumnType::Uuid },
171+
ColumnType::Cidr => quote! { ColumnType::Cidr },
172+
ColumnType::Inet => quote! { ColumnType::Inet },
171173
ColumnType::Custom(s) => {
172174
let s = s.to_string();
173175
quote! { ColumnType::custom(#s) }

0 commit comments

Comments
 (0)
Please sign in to comment.