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

Simplify table config fetching logic #99

Open
Wulf opened this issue Oct 28, 2023 · 2 comments
Open

Simplify table config fetching logic #99

Wulf opened this issue Oct 28, 2023 · 2 comments

Comments

@Wulf
Copy link
Owner

Wulf commented Oct 28, 2023

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
Copy link
Collaborator

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
Copy link
Owner Author

Wulf commented Oct 30, 2023

^ agreed. Two goals we should have for v3:

  • refactor the config options, including TableOptions to be more ergonomic for end users
  • reduce complexity in how we process/use the generation config / table options (like this issue)

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

2 participants