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

#113 in #postgres

Download history 302/week @ 2024-07-21 858/week @ 2024-07-28 396/week @ 2024-08-04 556/week @ 2024-08-11 359/week @ 2024-08-18 341/week @ 2024-08-25 349/week @ 2024-09-01 373/week @ 2024-09-08 286/week @ 2024-09-15 508/week @ 2024-09-22 418/week @ 2024-09-29 76/week @ 2024-10-06 335/week @ 2024-10-13 291/week @ 2024-10-20 355/week @ 2024-10-27 552/week @ 2024-11-03

1,534 downloads per month
Used in 6 crates (5 directly)

MIT/Apache

2MB
36K 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–10MB
~218K SLoC