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

Suggestion: Allow using custom type for certain table columns #27

Open
Boscop opened this issue Nov 21, 2019 · 0 comments
Open

Suggestion: Allow using custom type for certain table columns #27

Boscop opened this issue Nov 21, 2019 · 0 comments

Comments

@Boscop
Copy link

Boscop commented Nov 21, 2019

I have several instances of this pattern:
Table foo has a column that's TEXT NOT NULL, but it represents an enum in Rust, which is serialized as string in pg.
So the previous handwritten model struct contained an enum type for this field, but diesel_ext will generate String for it (of course).
In another similar use case, there is a typesafe newtype wrapper around a String field, which should be used in the model struct.
With the -M flag there is no way to override it, only to map ALL such types to another.
Please allow specifying custom Rust types for model fields, like:
--type "foo.bar MyEnum" --type "foo.baz MyStringWrapper".

That would be awesome, and one step closer to fully generated models.

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