Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom column names with default #80

Merged
merged 1 commit into from
Aug 13, 2021
Merged

Conversation

billy1624
Copy link
Member

As suggested on #79

@billy1624 billy1624 self-assigned this Aug 13, 2021
@billy1624
Copy link
Member Author

Now we have...

// If your column names are not in snake-case, derive `DeriveCustomColumn` here.
#[derive(Copy, Clone, Debug, EnumIter, DeriveCustomColumn)]
pub enum Column {
Id,
Name,
}
// Then, customize each column names here.
impl IdenStatic for Column {
fn as_str(&self) -> &str {
match self {
// Override column names
Self::Id => "id",
// Leave all other columns using default snake-case values
_ => self.default_as_str(),
}
}
}

@billy1624 billy1624 force-pushed the custom-column-name-default branch from 7063ff6 to 584c6fc Compare August 13, 2021 04:01
@tyt2y3 tyt2y3 merged commit 69b0ae1 into master Aug 13, 2021
@tyt2y3 tyt2y3 deleted the custom-column-name-default branch August 13, 2021 13:39
@tyt2y3
Copy link
Member

tyt2y3 commented Aug 13, 2021

Remember to release a new ver and change our Cargo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants