#orm #postgres #sql #codegen

diesel_codegen_syntex

Allows use of diesel_codegen with syntex

5 unstable releases

Uses old Rust 2015

0.9.0 Dec 8, 2016
0.8.0 Oct 10, 2016
0.7.2 Aug 20, 2016
0.7.1 Aug 11, 2016
0.7.0 Aug 1, 2016

#2034 in Database interfaces

Download history 74/week @ 2023-10-28 57/week @ 2023-11-04 64/week @ 2023-11-11 68/week @ 2023-11-18 69/week @ 2023-11-25 67/week @ 2023-12-02 49/week @ 2023-12-09 77/week @ 2023-12-16 75/week @ 2023-12-23 44/week @ 2023-12-30 70/week @ 2024-01-06 66/week @ 2024-01-13 70/week @ 2024-01-20 69/week @ 2024-01-27 53/week @ 2024-02-03 79/week @ 2024-02-10

282 downloads per month

MIT/Apache

2MB
33K SLoC

Diesel Codegen Syntex

Provides the functionality of diesel_codegen using Syntex for usage on stable.

Getting started

Add diesel_codegen_syntex to your Cargo.toml, specifying which backends you use.

diesel_codegen_syntex = { version = "0.9.0", features = ["postgres"] }

Next, move the mod declarations of any modules that need codegen to a separate file, such as lib.in.rs, like so:

// main.in.rs
mod schema;
mod models;
// main.rs
include!(concat!(env!("OUT_DIR"), "/main.rs"));

Finally, add a build file which calls diesel_codgen_syntex::expand

// build.rs
fn main() {
    let out_dir = env::var("OUT_DIR").unwrap();
    let src = Path::new("src/main.in.rs");
    let dst = Path::new(&out_dir).join("main.rs");
    diesel_codegen_syntex::expand(&src, &dst).unwrap();
}

For more examples, please see section 4 of the getting started guide

Dependencies

~2.3–5.5MB
~117K SLoC