Open Bajix opened 4 years ago
This is nice but I think as content it is more appropriate for the main diesel
docs. This crate has no particular opinion on how to structure your application.
I've thought about this a bit more and actually it's the cleanest solution to the problem of auto-generated diesel types not matching up with mapping names. So I think I should mention it in the README
I've come up with a clever design pattern that simplifies the dilemma of making accessible types within schema.rs
Instead of listing all
import_types
within diesel.toml as mapping to individual crates, instead make a diesel_types module and then pub use everything that's needed.An example: Diesel.toml
diesel_types.rs
users/gender.rs
The advantage of this design pattern is that it's easier to do aliases and that because you're guaranteed types will be used there won't be any compiler warnings. It's a simple way to import all enums, base types and to address the TsVector alias all in one.