Generic model operations #68

Open
opened 2024-12-29 15:39:36 +00:00 by matous-volf · 0 comments
Owner

Consider making the CRUD operations on models more universal. For instance, implementing a generic function that returns all instances of the passed model from the corresponding table.

What could also be done is to have a Model trait with the CRUD methods.

Furthermore, models could have a (not static) methods like delete calling the corresponding server functions with their self IDs passed in.

Extending Diesel

Update: It seems this is not recommended. Read Composing applications with Diesel instead.

Consider making the CRUD operations on models more universal. For instance, implementing a generic function that returns all instances of the passed model from the corresponding table. What could also be done is to have a `Model` trait with the CRUD methods. Furthermore, models could have a (not static) methods like `delete` calling the corresponding server functions with their `self` IDs passed in. [*Extending Diesel*](https://diesel.rs/guides/extending-diesel.html) **Update:** It seems [this is not recommended](https://github.com/diesel-rs/diesel/discussions/3968#discussioncomment-8844810). Read [Composing applications with Diesel](https://diesel.rs/guides/composing-applications.html) instead.
matous-volf added the
refactor
label 2024-12-29 15:39:36 +00:00
matous-volf added this to the Backlog project 2024-12-29 15:39:36 +00:00
Sign in to join this conversation.
No Milestone
No project Backlog
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: matous-volf/todo-baggins#68
No description provided.