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

Support enums? #8

Open
JosiahParry opened this issue Jun 15, 2024 · 0 comments
Open

Support enums? #8

JosiahParry opened this issue Jun 15, 2024 · 0 comments

Comments

@JosiahParry
Copy link
Contributor

I'd like to be able to use an enum to specify a field. Ideally, I can be able to have an enum that I can use then that would get stored as a String in the table

use ryzz::*;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
enum ContentType {
    Shiny,
    Plumber,
    Rmd,
    Qmd,
}

#[table("content")]
struct Content {
    #[ryzz(pk)]
    id: String,
    name: String,
    entrypoint: String,
    slug: Option<String>,
    content_type: ContentType,
}
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

No branches or pull requests

1 participant