#enums #fields #postgresql #derive #diesel #varchar #diesel-enum

macro diesel_enum_derive

Simple Enum derive for [Postgres only] Varchar fields

7 releases (2 stable)

Uses old Rust 2015

1.0.1 Sep 14, 2022
1.0.0 Jun 14, 2022
0.1.4 Feb 4, 2022
0.1.3 Aug 16, 2018
0.1.0 Jul 5, 2018

#793 in Procedural macros

Download history 30/week @ 2024-03-13 22/week @ 2024-03-20 10/week @ 2024-03-27 38/week @ 2024-04-03 29/week @ 2024-04-10 30/week @ 2024-04-17 42/week @ 2024-04-24 22/week @ 2024-05-01 25/week @ 2024-05-08 12/week @ 2024-05-15 13/week @ 2024-05-22 190/week @ 2024-05-29 130/week @ 2024-06-05 176/week @ 2024-06-12 105/week @ 2024-06-19 98/week @ 2024-06-26

569 downloads per month

MIT license

7KB
118 lines

Diesel enum derive

Please note that this crate is aimed to be simple and stick to a simple usage, no fancy configuration, only Pg with Text fields.

For a more advanced usage, see this crate: adwhit/diesel-derive-enum

Usage

#[derive(DieselEnum)]
pub enum Role {
    Admin,
    User,
}

The method Role::Admin.db_value() returns the database representation of this variant.

Dependencies

~1.5MB
~35K SLoC