Wulf / dsync

Generate rust structs & query functions from diesel schema files
Other
70 stars 13 forks source link

feat: custom derive as config #98

Open jjangga0214 opened 1 year ago

jjangga0214 commented 1 year ago

Maybe sometimes custom derives would be needed, IMHO.

#[derive(Debug, Clone)]
pub struct TableOptions<'a> {
    // ... other fields are omitted for brevity. 

    /// any arbitrary derives to append
    extra_derives: Vec<&'a str>
}

How about this? Thanks.

hasezoey commented 1 year ago

i dont think such a field would be a good idea, but maybe a callback function that runs custom code to extend the list? that way no multiple fields are necessary for each struct type and extra conditions can be added.

also i dont think it is currently possible with a callback function, until #87 is merged which refactored the generation to use a vector instead of static format!("{derive1}{derive2}")