diesel_cli_ext
diesel_cli_ext copied to clipboard
Suggestion: Allow using custom type for certain table columns
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.