#enums #diesel #fields #derive #postgresql #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

#1380 in Procedural macros

Download history 241/week @ 2024-07-27 67/week @ 2024-08-03 16/week @ 2024-08-10 278/week @ 2024-08-17 23/week @ 2024-08-24 159/week @ 2024-08-31 66/week @ 2024-09-07 83/week @ 2024-09-14 104/week @ 2024-09-21 56/week @ 2024-09-28 38/week @ 2024-10-05 50/week @ 2024-10-12 23/week @ 2024-10-19 12/week @ 2024-10-26 30/week @ 2024-11-02 28/week @ 2024-11-09

97 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
~38K SLoC