Skip to main content

generate_from_schema

Function generate_from_schema 

Source
pub fn generate_from_schema(
    schema: &SchemaFile,
) -> Result<GeneratedOutput, CodegenError>
Expand description

Generate code from an already-parsed schema.

Produces a nested directory structure:

{output}/
  mod.rs
  store.rs
  models/
    mod.rs
    {entity}.rs ...
  migrations/
    mod.rs
    helpers.rs
    {entity}_migrations.rs ...
  repositories/
    mod.rs
    traits.rs
    {entity}_repo.rs ...
  events/         (if config.events.enabled)
    mod.rs
    policies.rs
    {entity}_events.rs ...
  sync/           (if config.sync.enabled)
    mod.rs
    {entity}_sync.rs ...