generate

Function generate 

Source
pub fn generate(
    output: &Path,
    versions: Vec<(usize, Version)>,
    queries: Vec<Query>,
) -> Result<(), Vec<String>>
Expand description

Generate Rust code for migrations and queries.

§Arguments

  • output - the path to a single rust source file where the output will be written

  • versions - a list of database version ids and schema versions. The ids must be consecutive but can start from any number. Once a version has been applied to a production database it shouldn’t be modified again (modifications should be done in a new version).

    These will be turned into migrations as part of the migrate function.

  • queries - a list of queries against the schema in the latest version. These will be turned into functions.

§Returns

  • Error - a list of validation or generation errors that occurred