New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sea-orm-cli generate error #2182
Comments
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;impl EntityName for Entity { fn table_name (& self) -> & str { "wms_warehouse" } } [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub warehouse_id : String , pub warehouse_name : Option < String > , pub warehouse_code : Option < String > , pub warehouse_type : Option < String > , pub address : Option < String > , pub address_detail : Option < String > , pub address_ids : Option < String > , pub remark : Option < String > , pub status : Option < String > , }[derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { WarehouseId , WarehouseName , WarehouseCode , WarehouseType , Address , AddressDetail , AddressIds , Remark , Status , }[derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { }impl PrimaryKeyTrait for PrimaryKey { type ValueType = ; fn auto_increment () -> bool { false } } [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { }impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: WarehouseId => ColumnType :: String (Some (64u32)) . def () , Self :: WarehouseName => ColumnType :: String (Some (255u32)) . def () . null () , Self :: WarehouseCode => ColumnType :: String (Some (255u32)) . def () . null () , Self :: WarehouseType => ColumnType :: String (Some (255u32)) . def () . null () , Self :: Address => ColumnType :: String (Some (255u32)) . def () . null () , Self :: AddressDetail => ColumnType :: String (Some (255u32)) . def () . null () , Self :: AddressIds => ColumnType :: String (Some (64u32)) . def () . null () , Self :: Remark => ColumnType :: String (Some (500u32)) . def () . null () , Self :: Status => ColumnType :: Char (Some (1u32)) . def () . null () , } } } impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } } impl ActiveModelBehavior for ActiveModel { }` |
When I use a primary key of type string, there is no normal entity generation
sea-orm-cli version:0.12.15
rust:1.77.1
sea-orm-cli generate entity -s public -o test --expanded-format --with-serde both -t wms_warehouse Connecting to Postgres ... Discovering schema ... ... discovered. Generating wms_warehouse.rs > Column
warehouse_id: String, not_null > Column
warehouse_name: Option<String> > Column
warehouse_code: Option<String> > Column
warehouse_type: Option<String> > Column
address: Option<String> > Column
address_detail: Option<String> > Column
address_ids: Option<String> > Column
remark: Option<String> > Column
status: Option<String> Writing test/wms_warehouse.rs Writing test/mod.rs Writing test/prelude.rs Warning: can't set
wrap_comments = true, unstable features are only available in nightly channel. Warning: can't set
format_code_in_doc_comments = true, unstable features are only available in nightly channel. Warning: can't set
normalize_comments = true, unstable features are only available in nightly channel. Warning: can't set
imports_granularity = Crate, unstable features are only available in nightly channel. Warning: can't set
group_imports = StdExternalCrate, unstable features are only available in nightly channel. Warning: can't set
unstable_features = true, unstable features are only available in nightly channel. error: expected type, found
;`--> /Users/wufei/item/rust/miaojue-erp/test/wms_warehouse.rs:17:56
|
17 | impl PrimaryKeyTrait for PrimaryKey { type ValueType = ; fn auto_increment () -> bool { false } }
| - ^ expected type - the item list ends here
| |
| while parsing this item list starting here
Fail to format file
wms_warehouse.rs
`
The text was updated successfully, but these errors were encountered: