27 releases (15 breaking)

Uses old Rust 2015

0.16.1 May 27, 2018
0.16.0 Aug 24, 2017
0.15.0 Jul 23, 2017
0.12.0 Mar 16, 2017
0.2.0 Nov 30, 2015

#32 in #query-builder

Download history 944/week @ 2023-10-28 863/week @ 2023-11-04 723/week @ 2023-11-11 885/week @ 2023-11-18 847/week @ 2023-11-25 608/week @ 2023-12-02 653/week @ 2023-12-09 903/week @ 2023-12-16 799/week @ 2023-12-23 459/week @ 2023-12-30 775/week @ 2024-01-06 837/week @ 2024-01-13 771/week @ 2024-01-20 785/week @ 2024-01-27 560/week @ 2024-02-03 862/week @ 2024-02-10

3,081 downloads per month
Used in 6 crates (5 directly)

MIT/Apache

2MB
33K SLoC

Diesel Codegen

This crate implements Diesel's procedural macros using the Macros 1.1 system. It depends on features introduced in Rust 1.15. Make sure to always use the latest stable release for optimal performance and feature support.

Diesel Codegen provides custom derive implementations for Queryable, Identifiable, Insertable, AsChangeset, and Associations. It also provides the macros infer_schema!, infer_table_from_schema!, and embed_migrations!.

Using this crate

First, add this crate to Cargo.toml as so:

diesel_codegen = { version = "0.16.0", features = ["postgres"] }

If you are using SQLite, be sure to specify sqlite instead of postgres in the features section.

Next, at the root of your crate add:

#[macro_use] extern crate diesel_codegen;

See the documentation for each trait/macro for additional details and configuration options.

Dependencies

~5.5–9.5MB
~201K SLoC