From fee320f33da78697048c89186bc9a0ef08c52d86 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Fri, 25 Oct 2024 12:14:55 +0800 Subject: [PATCH] Add ipnetwork support for codegen --- sea-orm-codegen/src/entity/column.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sea-orm-codegen/src/entity/column.rs b/sea-orm-codegen/src/entity/column.rs index 13d730e05..4dfee8277 100644 --- a/sea-orm-codegen/src/entity/column.rs +++ b/sea-orm-codegen/src/entity/column.rs @@ -79,11 +79,10 @@ impl Column { ColumnType::Bit(None | Some(1)) => "bool".to_owned(), ColumnType::Bit(_) | ColumnType::VarBit(_) => "Vec".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!(), } } @@ -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 }) @@ -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) }