mold_cli/generators/
mod.rs1mod prisma;
2mod typescript;
3mod zod;
4
5pub use prisma::PrismaGenerator;
6pub use typescript::TypeScriptGenerator;
7pub use zod::ZodGenerator;
8
9use crate::types::Schema;
10use anyhow::Result;
11
12#[derive(Debug, Clone)]
14pub struct GeneratorConfig {
15 pub flat_mode: bool,
16 pub indent: String,
17}
18
19impl Default for GeneratorConfig {
20 fn default() -> Self {
21 Self {
22 flat_mode: false,
23 indent: " ".to_string(),
24 }
25 }
26}
27
28pub trait Generator {
30 fn generate(&self, schema: &Schema, config: &GeneratorConfig) -> Result<String>;
31 fn file_extension(&self) -> &'static str;
32}