Codegen mod.rs include prelude

This commit is contained in:
Billy Chan 2021-08-17 12:41:34 +08:00 committed by Chris Tsang
parent 2580f65696
commit aea4ec2d54
2 changed files with 10 additions and 1 deletions

View File

@ -44,11 +44,18 @@ impl EntityWriter {
pub fn write_mod(&self) -> OutputFile {
let mut lines = Vec::new();
Self::write_doc_comment(&mut lines);
let code_blocks = self
let code_blocks: Vec<TokenStream> = self
.entities
.iter()
.map(|entity| Self::gen_mod(entity))
.collect();
Self::write(
&mut lines,
vec![quote! {
pub mod prelude;
}],
);
lines.push("".to_owned());
Self::write(&mut lines, code_blocks);
OutputFile {
name: "mod.rs".to_owned(),

View File

@ -1,5 +1,7 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0
pub mod prelude;
pub mod cake;
pub mod cake_filling;
pub mod filling;