MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / run_generate_command

Function run_generate_command

sea-orm-cli/src/commands/generate.rs:12–264  ·  view source on GitHub ↗
(
    command: GenerateSubcommands,
    verbose: bool,
)

Source from the content-addressed store, hash-verified

10use crate::{DateTimeCrate, GenerateSubcommands};
11
12pub async fn run_generate_command(
13 command: GenerateSubcommands,
14 verbose: bool,
15) -> Result<(), Box<dyn Error>> {
16 match command {
17 GenerateSubcommands::Entity {
18 compact_format: _,
19 expanded_format,
20 frontend_format,
21 include_hidden_tables,
22 tables,
23 ignore_tables,
24 max_connections,
25 acquire_timeout,
26 output_dir,
27 database_schema,
28 database_url,
29 with_prelude,
30 with_serde,
31 serde_skip_deserializing_primary_key,
32 serde_skip_hidden_column,
33 with_copy_enums,
34 date_time_crate,
35 lib,
36 model_extra_derives,
37 model_extra_attributes,
38 enum_extra_derives,
39 enum_extra_attributes,
40 seaography,
41 impl_active_model_behavior,
42 } => {
43 if verbose {
44 let _ = tracing_subscriber::fmt()
45 .with_max_level(tracing::Level::DEBUG)
46 .with_test_writer()
47 .try_init();
48 } else {
49 let filter_layer = EnvFilter::try_new("sea_orm_codegen=info").unwrap();
50 let fmt_layer = tracing_subscriber::fmt::layer()
51 .with_target(false)
52 .with_level(false)
53 .without_time();
54
55 let _ = tracing_subscriber::registry()
56 .with(filter_layer)
57 .with(fmt_layer)
58 .try_init();
59 }
60
61 // The database should be a valid URL that can be parsed
62 // protocol://username:password@host/database_name
63 let url = Url::parse(&database_url)?;
64
65 // Make sure we have all the required url components
66 //
67 // Missing scheme will have been caught by the Url::parse() call
68 // above
69 let is_sqlite = url.scheme() == "sqlite";

Calls 13

unwrapMethod · 0.80
containsMethod · 0.80
starts_withMethod · 0.80
nextMethod · 0.80
filterMethod · 0.80
into_iterMethod · 0.80
writeMethod · 0.80
generateMethod · 0.80
joinMethod · 0.80
newFunction · 0.50
createFunction · 0.50
as_strMethod · 0.45