SeaQL / SeaQL/sea-orm

Permit passing custom derives to ActiveModelEx

Open
#3,173 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.9k
Forks
734
Avg merge
6h 36m
Merged PRs (30d)
8

Description

Motivation

I'm trying to get the dioxus Store derive to work on the same struct as a sea_orm::model derive so i can use the same struct for reactive data stores and also database insert queries.

Proposed Solutions

PR #2933 already permits derives to pass to Model and ModelEx, via either normal derive syntax or model_attrs. I think the best solution here is to expand this system to all other auto-generated structs, eg active_model_ex_attrs. extra derives on the entire struct will pass to all autogenerated structs, and there will also be the attrs thing for finer grain control

Additional Information

I was planning on writing this myself and PRing the fix, but I also felt it would be better to submit an issue before doing that so yall can see this.

My current barebones proof of concept:

https://github.com/machineonamission/PowerJournal/blob/8479a27a76220d766a15abb8f3939f507da3a4a1/src/views/new_entry.rs

https://github.com/SeaQL/sea-orm/commit/b3827a752b8f5c73b494ca1e82c49f288643276a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PR #2933 and the existing Model and ModelEx derive handling, then trace how ActiveModelEx and the other autogenerated structs are produced. The work is complete when custom derives can be passed to ActiveModelEx, including the proposed active_model_ex_attrs-style per-struct control, with coverage for the supported derive forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.