#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

#995 in Procedural macros

Download history 20/week @ 2023-12-11 11/week @ 2023-12-18 1/week @ 2024-01-08 17/week @ 2024-01-22 28/week @ 2024-01-29 26/week @ 2024-02-12 43/week @ 2024-02-19 40/week @ 2024-02-26 36/week @ 2024-03-04 29/week @ 2024-03-11 32/week @ 2024-03-18 19/week @ 2024-03-25

123 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
~34K SLoC