diff --git a/sea-orm-codegen/src/entity/writer.rs b/sea-orm-codegen/src/entity/writer.rs index b94b9aa5e0..c765a82550 100644 --- a/sea-orm-codegen/src/entity/writer.rs +++ b/sea-orm-codegen/src/entity/writer.rs @@ -879,7 +879,10 @@ mod tests { use proc_macro2::TokenStream; use quote::quote; use sea_query::{Alias, ColumnType, ForeignKeyAction, RcOrArc, SeaRc, StringLen}; - use std::io::{self, BufRead, BufReader, Read}; + use std::{ + io::{self, BufRead, BufReader, Read}, + sync::Arc, + }; fn default_column_option() -> ColumnOption { Default::default() @@ -1576,6 +1579,106 @@ mod tests { name: "id".to_owned(), }], }, + Entity { + table_name: "imports".to_owned(), + columns: vec![ + Column { + name: "a".to_owned(), + col_type: ColumnType::Json, + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "b".to_owned(), + col_type: ColumnType::Date, + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "c".to_owned(), + col_type: ColumnType::Time, + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "d".to_owned(), + col_type: ColumnType::DateTime, + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "e".to_owned(), + col_type: ColumnType::TimestampWithTimeZone, + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "f".to_owned(), + col_type: ColumnType::Decimal(None), + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "g".to_owned(), + col_type: ColumnType::Uuid, + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "h".to_owned(), + col_type: ColumnType::Vector(None), + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "i".to_owned(), + col_type: ColumnType::Inet, + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "j".to_owned(), + col_type: ColumnType::Array(Arc::new(ColumnType::Json)), + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + Column { + name: "k".to_owned(), + col_type: ColumnType::Array(Arc::new(ColumnType::Array(Arc::new( + ColumnType::Cidr, + )))), + auto_increment: true, + not_null: true, + unique: false, + unique_key: None, + }, + ], + relations: vec![], + conjunct_relations: vec![], + primary_keys: vec![PrimaryKey { + name: "a".to_owned(), + }], + }, ] } @@ -1618,7 +1721,7 @@ mod tests { #[test] fn test_gen_expanded_code_blocks() -> io::Result<()> { let entities = setup(); - const ENTITY_FILES: [&str; 13] = [ + const ENTITY_FILES: [&str; 14] = [ include_str!("../../tests/expanded/cake.rs"), include_str!("../../tests/expanded/cake_filling.rs"), include_str!("../../tests/expanded/cake_filling_price.rs"), @@ -1632,8 +1735,9 @@ mod tests { include_str!("../../tests/expanded/collection_float.rs"), include_str!("../../tests/expanded/parent.rs"), include_str!("../../tests/expanded/child.rs"), + include_str!("../../tests/expanded/imports.rs"), ]; - const ENTITY_FILES_WITH_SCHEMA_NAME: [&str; 13] = [ + const ENTITY_FILES_WITH_SCHEMA_NAME: [&str; 14] = [ include_str!("../../tests/expanded_with_schema_name/cake.rs"), include_str!("../../tests/expanded_with_schema_name/cake_filling.rs"), include_str!("../../tests/expanded_with_schema_name/cake_filling_price.rs"), @@ -1647,6 +1751,7 @@ mod tests { include_str!("../../tests/expanded_with_schema_name/collection_float.rs"), include_str!("../../tests/expanded_with_schema_name/parent.rs"), include_str!("../../tests/expanded_with_schema_name/child.rs"), + include_str!("../../tests/expanded_with_schema_name/imports.rs"), ]; assert_eq!(entities.len(), ENTITY_FILES.len()); @@ -1706,7 +1811,7 @@ mod tests { #[test] fn test_gen_compact_code_blocks() -> io::Result<()> { let entities = setup(); - const ENTITY_FILES: [&str; 13] = [ + const ENTITY_FILES: [&str; 14] = [ include_str!("../../tests/compact/cake.rs"), include_str!("../../tests/compact/cake_filling.rs"), include_str!("../../tests/compact/cake_filling_price.rs"), @@ -1720,8 +1825,9 @@ mod tests { include_str!("../../tests/compact/collection_float.rs"), include_str!("../../tests/compact/parent.rs"), include_str!("../../tests/compact/child.rs"), + include_str!("../../tests/compact/imports.rs"), ]; - const ENTITY_FILES_WITH_SCHEMA_NAME: [&str; 13] = [ + const ENTITY_FILES_WITH_SCHEMA_NAME: [&str; 14] = [ include_str!("../../tests/compact_with_schema_name/cake.rs"), include_str!("../../tests/compact_with_schema_name/cake_filling.rs"), include_str!("../../tests/compact_with_schema_name/cake_filling_price.rs"), @@ -1735,6 +1841,7 @@ mod tests { include_str!("../../tests/compact_with_schema_name/collection_float.rs"), include_str!("../../tests/compact_with_schema_name/parent.rs"), include_str!("../../tests/compact_with_schema_name/child.rs"), + include_str!("../../tests/compact_with_schema_name/imports.rs"), ]; assert_eq!(entities.len(), ENTITY_FILES.len()); @@ -1794,7 +1901,7 @@ mod tests { #[test] fn test_gen_frontend_code_blocks() -> io::Result<()> { let entities = setup(); - const ENTITY_FILES: [&str; 13] = [ + const ENTITY_FILES: [&str; 14] = [ include_str!("../../tests/frontend/cake.rs"), include_str!("../../tests/frontend/cake_filling.rs"), include_str!("../../tests/frontend/cake_filling_price.rs"), @@ -1808,8 +1915,9 @@ mod tests { include_str!("../../tests/frontend/collection_float.rs"), include_str!("../../tests/frontend/parent.rs"), include_str!("../../tests/frontend/child.rs"), + include_str!("../../tests/frontend/imports.rs"), ]; - const ENTITY_FILES_WITH_SCHEMA_NAME: [&str; 13] = [ + const ENTITY_FILES_WITH_SCHEMA_NAME: [&str; 14] = [ include_str!("../../tests/frontend_with_schema_name/cake.rs"), include_str!("../../tests/frontend_with_schema_name/cake_filling.rs"), include_str!("../../tests/frontend_with_schema_name/cake_filling_price.rs"), @@ -1823,6 +1931,7 @@ mod tests { include_str!("../../tests/frontend_with_schema_name/collection_float.rs"), include_str!("../../tests/frontend_with_schema_name/parent.rs"), include_str!("../../tests/frontend_with_schema_name/child.rs"), + include_str!("../../tests/frontend_with_schema_name/imports.rs"), ]; assert_eq!(entities.len(), ENTITY_FILES.len()); @@ -1879,6 +1988,35 @@ mod tests { Ok(()) } + #[test] + fn test_gen_frontend_imports() -> io::Result<()> { + let imports_entity = setup().into_iter() + .find(|e| e.get_table_name_snake_case() == "imports") + .unwrap(); + + + assert_eq!(imports_entity.get_table_name_snake_case(), "imports"); + + assert_eq!( + comparable_file_string(include_str!("../../tests/frontend_with_imports/imports.rs"))?, + generated_to_string(EntityWriter::gen_frontend_code_blocks( + &imports_entity, + &WithSerde::None, + &default_column_option(), + &None, + true, + false, + &TokenStream::new(), + &TokenStream::new(), + &TokenStream::new(), + false, + true, + )) + ); + + Ok(()) + } + #[test] fn test_gen_with_serde() -> io::Result<()> { let cake_entity = setup().get(0).unwrap().clone(); @@ -3032,7 +3170,7 @@ mod tests { #[test] fn test_gen_dense_code_blocks() -> io::Result<()> { let entities = setup(); - const ENTITY_FILES: [&str; 13] = [ + const ENTITY_FILES: [&str; 14] = [ include_str!("../../tests/dense/cake.rs"), include_str!("../../tests/dense/cake_filling.rs"), include_str!("../../tests/dense/cake_filling_price.rs"), @@ -3046,6 +3184,7 @@ mod tests { include_str!("../../tests/dense/collection_float.rs"), include_str!("../../tests/dense/parent.rs"), include_str!("../../tests/dense/child.rs"), + include_str!("../../tests/dense/imports.rs"), ]; assert_eq!(entities.len(), ENTITY_FILES.len()); diff --git a/sea-orm-codegen/src/entity/writer/frontend.rs b/sea-orm-codegen/src/entity/writer/frontend.rs index 6b2fa2507c..7d262377df 100644 --- a/sea-orm-codegen/src/entity/writer/frontend.rs +++ b/sea-orm-codegen/src/entity/writer/frontend.rs @@ -1,5 +1,41 @@ +use sea_query::ColumnType; +use std::collections::HashSet; + use super::*; +// seperate enum so `ColumnType` doesnt need to derive `Hash` or `Eq` +#[derive(Hash, PartialEq, Eq)] +enum ExternalTypes { + JsonOrJsonBinary, + Date, + Time, + DateTime, + Timestamp, + TimestampWithTimeZone, + DecimalOrMoney, + Uuid, + Vector, + CidrOrInet, +} + +impl ExternalTypes { + fn from_column_type(col_type: &ColumnType) -> Option { + Some(match col_type { + ColumnType::Json | ColumnType::JsonBinary => Self::JsonOrJsonBinary, + ColumnType::Date => Self::Date, + ColumnType::Time => Self::Time, + ColumnType::DateTime => Self::DateTime, + ColumnType::Timestamp => Self::Timestamp, + ColumnType::TimestampWithTimeZone => Self::TimestampWithTimeZone, + ColumnType::Decimal(..) | ColumnType::Money(..) => Self::DecimalOrMoney, + ColumnType::Uuid => Self::Uuid, + ColumnType::Vector(..) => Self::Vector, + ColumnType::Cidr | ColumnType::Inet => Self::CidrOrInet, + _ => return None, + }) + } +} + impl EntityWriter { #[allow(clippy::too_many_arguments)] pub fn gen_frontend_code_blocks( @@ -17,6 +53,7 @@ impl EntityWriter { ) -> Vec { let mut imports = Self::gen_import_serde(with_serde); imports.extend(Self::gen_import_active_enum(entity)); + imports.extend(Self::gen_import_frontend(entity, column_option)); let code_blocks = vec![ imports, Self::gen_frontend_model_struct( @@ -77,4 +114,126 @@ impl EntityWriter { } } } + + pub fn gen_import_frontend(entity: &Entity, opt: &ColumnOption) -> TokenStream { + fn collect( + col_type: &ColumnType, + opt: &ColumnOption, + date_time: &mut Vec, + aliases: &mut Vec, + plain_uses: &mut Vec, + encountered: &mut HashSet, + ) { + // skip column types we have already generated imports for + if let Some(ty) = ExternalTypes::from_column_type(col_type) { + if !encountered.insert(ty) { + return; + } + } + + match col_type { + ColumnType::Json | ColumnType::JsonBinary => { + plain_uses.push(quote! { use serde_json::Value as Json; }); + } + ColumnType::Date => match opt.date_time_crate { + DateTimeCrate::Chrono => { + date_time.push(quote! { NaiveDate as Date }); + } + DateTimeCrate::Time => { + date_time.push(quote! { Date as TimeDate }); + } + }, + ColumnType::Time => match opt.date_time_crate { + DateTimeCrate::Chrono => { + date_time.push(quote! { NaiveTime as Time }); + } + DateTimeCrate::Time => { + date_time.push(quote! { Time as TimeTime }); + } + }, + ColumnType::DateTime => match opt.date_time_crate { + DateTimeCrate::Chrono => { + date_time.push(quote! { NaiveDateTime as DateTime }); + } + DateTimeCrate::Time => { + date_time.push(quote! { PrimitiveDateTime as TimeDateTime }); + } + }, + ColumnType::Timestamp => match opt.date_time_crate { + DateTimeCrate::Chrono => { + aliases.push(quote! { + type DateTimeUtc = chrono::DateTime; + }); + } + DateTimeCrate::Time => { + date_time.push(quote! { PrimitiveDateTime as TimeDateTime }); + } + }, + ColumnType::TimestampWithTimeZone => match opt.date_time_crate { + DateTimeCrate::Chrono => { + aliases.push(quote! { + type DateTimeWithTimeZone = chrono::DateTime; + }); + } + DateTimeCrate::Time => { + date_time.push(quote! { OffsetDateTime as TimeDateTimeWithTimeZone }); + } + }, + ColumnType::Decimal(_) | ColumnType::Money(_) => { + plain_uses.push(quote! { use rust_decimal::Decimal; }) + } + ColumnType::Uuid => { + plain_uses.push(quote! { use uuid::Uuid; }); + } + ColumnType::Vector(_) => { + plain_uses.push(quote! { use pgvector::Vector as PgVector; }); + } + ColumnType::Cidr | ColumnType::Inet => { + plain_uses.push(quote! { use ipnetwork::IpNetwork; }); + } + ColumnType::Array(inner) => { + collect( + inner.as_ref(), + opt, + date_time, + aliases, + plain_uses, + encountered, + ); + } + _ => {} + } + } + + let mut date_time_uses = Vec::new(); + let mut aliases = Vec::new(); + let mut plain_uses = Vec::new(); + let mut encountered = HashSet::new(); + + for col in &entity.columns { + collect( + &col.col_type, + opt, + &mut date_time_uses, + &mut aliases, + &mut plain_uses, + &mut encountered, + ); + } + + let time_use = if date_time_uses.is_empty() { + quote! {} + } else { + match opt.date_time_crate { + DateTimeCrate::Chrono => quote! { use chrono::{ #(#date_time_uses),* }; }, + DateTimeCrate::Time => quote! { use time::{ #(#date_time_uses),* }; }, + } + }; + + quote! { + #time_use + #(#plain_uses)* + #(#aliases)* + } + } } diff --git a/sea-orm-codegen/tests/compact/imports.rs b/sea-orm-codegen/tests/compact/imports.rs new file mode 100644 index 0000000000..fa6c356f2d --- /dev/null +++ b/sea-orm-codegen/tests/compact/imports.rs @@ -0,0 +1,25 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0 + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "imports")] +pub struct Model { + #[sea_orm(primary_key)] + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/sea-orm-codegen/tests/compact_with_schema_name/imports.rs b/sea-orm-codegen/tests/compact_with_schema_name/imports.rs new file mode 100644 index 0000000000..93ff2ef927 --- /dev/null +++ b/sea-orm-codegen/tests/compact_with_schema_name/imports.rs @@ -0,0 +1,25 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0 + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(schema_name = "schema_name", table_name = "imports")] +pub struct Model { + #[sea_orm(primary_key)] + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/sea-orm-codegen/tests/dense/imports.rs b/sea-orm-codegen/tests/dense/imports.rs new file mode 100644 index 0000000000..4f88bbe423 --- /dev/null +++ b/sea-orm-codegen/tests/dense/imports.rs @@ -0,0 +1,23 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0 + +use sea_orm::entity::prelude::*; + +#[sea_orm::model] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "imports")] +pub struct Model { + #[sea_orm(primary_key)] + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/sea-orm-codegen/tests/expanded/imports.rs b/sea-orm-codegen/tests/expanded/imports.rs new file mode 100644 index 0000000000..8f17a58e89 --- /dev/null +++ b/sea-orm-codegen/tests/expanded/imports.rs @@ -0,0 +1,87 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0 + +use sea_orm::entity::prelude::*; + +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; + +impl EntityName for Entity { + fn table_name(&self) -> & 'static str { + "imports" + } +} + +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +pub struct Model { + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, +} + +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + A, +} + +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = Json; + fn auto_increment() -> bool { + true + } +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} + +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::A => ColumnType::Json.def(), + Self::B => ColumnType::Date.def(), + Self::C => ColumnType::Time.def(), + Self::D => ColumnType::DateTime.def(), + Self::E => ColumnType::TimestampWithTimeZone.def(), + Self::F => ColumnType::Decimal(None).def(), + Self::G => ColumnType::Uuid.def(), + Self::H => ColumnType::Vector(None).def(), + Self::I => ColumnType::Inet.def(), + Self::J => ColumnType::Array(RcOrArc::new(ColumnType::Json)).def(), + Self::K => ColumnType::Array(RcOrArc::new(ColumnType::Array(RcOrArc::new( + ColumnType::Cidr + )))) + .def(), + } + } +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/sea-orm-codegen/tests/expanded_with_schema_name/imports.rs b/sea-orm-codegen/tests/expanded_with_schema_name/imports.rs new file mode 100644 index 0000000000..b98d5b8426 --- /dev/null +++ b/sea-orm-codegen/tests/expanded_with_schema_name/imports.rs @@ -0,0 +1,90 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 + +use sea_orm::entity::prelude::*; + +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; + +impl EntityName for Entity { + fn schema_name(&self) -> Option< &str> { + Some("schema_name") + } + fn table_name(&self) -> & 'static str { + "imports" + } +} + +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] +pub struct Model { + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, +} + +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + A, +} + +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = Json; + fn auto_increment() -> bool { + true + } +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} + +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::A => ColumnType::Json.def(), + Self::B => ColumnType::Date.def(), + Self::C => ColumnType::Time.def(), + Self::D => ColumnType::DateTime.def(), + Self::E => ColumnType::TimestampWithTimeZone.def(), + Self::F => ColumnType::Decimal(None).def(), + Self::G => ColumnType::Uuid.def(), + Self::H => ColumnType::Vector(None).def(), + Self::I => ColumnType::Inet.def(), + Self::J => ColumnType::Array(RcOrArc::new(ColumnType::Json)).def(), + Self::K => ColumnType::Array(RcOrArc::new(ColumnType::Array(RcOrArc::new( + ColumnType::Cidr + )))) + .def(), + } + } +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/sea-orm-codegen/tests/frontend/imports.rs b/sea-orm-codegen/tests/frontend/imports.rs new file mode 100644 index 0000000000..7aad07095e --- /dev/null +++ b/sea-orm-codegen/tests/frontend/imports.rs @@ -0,0 +1,16 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0 + +#[derive(Clone, Debug, PartialEq)] +pub struct Model { + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} diff --git a/sea-orm-codegen/tests/frontend_with_imports/imports.rs b/sea-orm-codegen/tests/frontend_with_imports/imports.rs new file mode 100644 index 0000000000..6f53966fe8 --- /dev/null +++ b/sea-orm-codegen/tests/frontend_with_imports/imports.rs @@ -0,0 +1,26 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0 + +use chrono::{NaiveDate as Date, NaiveTime as Time, NaiveDateTime as DateTime}; +use serde_json::Value as Json; +use rust_decimal::Decimal; +use uuid::Uuid; +use pgvector::Vector as PgVector; +use ipnetwork::IpNetwork; +type DateTimeWithTimeZone = chrono::DateTime ; + +#[derive(Clone, Debug, PartialEq)] +pub struct Model { + #[serde(skip_deserializing)] + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} + diff --git a/sea-orm-codegen/tests/frontend_with_schema_name/imports.rs b/sea-orm-codegen/tests/frontend_with_schema_name/imports.rs new file mode 100644 index 0000000000..7aad07095e --- /dev/null +++ b/sea-orm-codegen/tests/frontend_with_schema_name/imports.rs @@ -0,0 +1,16 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0 + +#[derive(Clone, Debug, PartialEq)] +pub struct Model { + pub a: Json, + pub b: Date, + pub c: Time, + pub d: DateTime, + pub e: DateTimeWithTimeZone, + pub f: Decimal, + pub g: Uuid, + pub h: PgVector, + pub i: IpNetwork, + pub j: Vec , + pub k: Vec> , +} diff --git a/sea-orm-codegen/tests/with_seaography/mod.rs b/sea-orm-codegen/tests/with_seaography/mod.rs index 59445e8d7a..0897f49a24 100644 --- a/sea-orm-codegen/tests/with_seaography/mod.rs +++ b/sea-orm-codegen/tests/with_seaography/mod.rs @@ -14,6 +14,7 @@ seaography::register_entity_modules!([ collection_float, parent, child, + imports, ]); seaography::register_active_enums!([