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
Enum codegen example #171
Comments
Well, I'll update the code gen example project asap. |
Thanks! Appreciate it very much :) |
Yeah, I noticed... I certainly appreciate your responsiveness :) take as much time as you need |
Ok, I need more time. ;-) |
I have working example if interested. |
@bearrito, yes, that's great. Can you send it to me? |
I can see this issue is still open? Is there a clear example somewhere of slick codegen working with Postgres enum types? |
Not yet. But pg enum types can only be mapped to |
Curiously, just to note something - JOOQ code generator works just fine with this situation - recognizes postgres enum types just fine and creates java enums accordingly, so it's not impossible, is it? |
@VRcOd thanks for the reminding! :-) I'll check JOOQ's codes to find how to distinguish and generate it. |
just a follow up - I'd also love to see possibility of generating enumeration classes from database schema. For my case (it's the simplest - just download all enum values together with labels and orders) sufficient SQL query was select t.typename, e.enumlabel, e.enumsortorder from pg_enum e
inner join pg_type t on t.oid=e.enumtypid then some postprocessing is needed, but it generates just fine. I should be able to post a full solution to GitHub later this week, let me know if you're interested |
@tlewowski yes, pls. 👍 |
I've posted a project here: https://github.com/tlewowski/pg-scala-enums what it needs:
what it does:
stuff like package or file name is hardcoded in several places and naming convention for generated classes is pretty opinionated, but I don't think it'd be a big deal to change it if anybody needs it. quite bad news is that it needs three execution steps - generate enum, generate profile and generate tables (they are now in three separate, dependent projects). This is required, because enums are needed for profile generation (profile includes I've checked the mapping in my project (not included) and it works well with BTW: thanks for this project, it really helps a lot! |
@tlewowski it looks good. :-) |
well, the thing is that it doesn't fit very well into the current flow, so I'm not sure if it's mergeable anyhow, or should I maintain it as separate project (ideally an SBT plugin). any ideas? |
I think it should be kept as a separate project, since it's more like a solution instead of a patch. |
Thanks for your awesome work!
Could you please provide an example where I would generate code that would convert a postgres enum. I am new to scala and slick, and can't seem to get this right.
Thanks!
The text was updated successfully, but these errors were encountered: