Wulf / dsync

Generate rust structs & query functions from diesel schema files
Other
70 stars 13 forks source link

Simplify table config fetching logic #99

Open Wulf opened 11 months ago

Wulf commented 11 months ago

Currently, we have a GenerationConfig#table(name) method that retreives the config for a particular table. This should be a simple retrieval, but instead, we make some changes to the table config before returning it. Let's move this to a pre-generation step in the beginning of lib.rs#generate_files.

Related comment here.

hasezoey commented 11 months ago

i was not sure what that function is meant to do, but i guessed by the usage and current code that it basically is:

a function to get a new instance of a table by name, and apply defaults again

then we should likely refactor this to actually be just a retrieval and generate all the tables in the beginning, but actually change it so that no new instance is created everytime and defaults applied (that us up to the user adding to that hashmap, right?)

i also wanted to refactor TableOptions itself to not use Options anymore and just use Default and remove the merger function (apply_defaults) and let it be up to the user

PS: i updated your link because the previous one was seemingly broken (likely because i rebased?)

Wulf commented 11 months ago

^ agreed. Two goals we should have for v3: