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

Separate naming in web crate from db crate #187

Open
marcoow opened this issue Jan 22, 2025 · 0 comments
Open

Separate naming in web crate from db crate #187

marcoow opened this issue Jan 22, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@marcoow
Copy link
Member

marcoow commented Jan 22, 2025

We currently do the same thing that's bad about Rails which is pushing people towards having a single concept of entity from the JSON API to the database table. E.g. for CRUD controllers, we use one name, e.g. notes that we then use for the controller's module name as well as to guess the name of the entity and the names of the functions to create, load, etc. entities.

We should have better separation here and use separate arguments for the controller name and for the entity name. In many cases both would be the same which would still not mean lots of additional effort for the developer (really just a few extra characters need to be typed) e.g.

cargo generate crud-controller notes Note

In some cases, the controller and entity names could also be different though, e.g.:

cargo generate crud-controller tasks Todo
@marcoow marcoow added the enhancement New feature or request label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant