#enums #fields #postgresql #derive #diesel #varchar

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

#859 in Procedural macros

Download history 42/week @ 2024-04-07 19/week @ 2024-04-14 41/week @ 2024-04-21 31/week @ 2024-04-28 12/week @ 2024-05-05 32/week @ 2024-05-12 4/week @ 2024-05-19 72/week @ 2024-05-26 239/week @ 2024-06-02 95/week @ 2024-06-09 166/week @ 2024-06-16 85/week @ 2024-06-23 131/week @ 2024-06-30 72/week @ 2024-07-07 94/week @ 2024-07-14 154/week @ 2024-07-21

452 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
~36K SLoC