SeaQL / SeaQL/sea-orm

implement `IntoMockRow` from derive for `FromQueryResult` to support testing

Open
#1,440 0 comments 1 reaction 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

When creating structs with #[derive(FromQueryResult)] it is annoying to translate them into MockRow, because the type is not really supportive to any implementations. To achive that, the only way is to create a BTreeMap<&str, Value> which implements IntoMockRow.

Proposed Solutions

I think the best idea would be to drop the trait IntoMockRow as it is hard to implement from the outside and instead automatically implement From<R: FromQueryResult> for IntoMockRow however it might be necessary to do that through derive.

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 the FromQueryResult derive and IntoMockRow entry points to understand how derived structs and MockRow are currently connected. Confirm the intended trait or derive-based design before changing anything. Done means a struct deriving FromQueryResult can be converted for testing without manually creating a BTreeMap<&str, Value>.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.