SeaQL / SeaQL/sea-orm

Add `into_tuple` to `SelectTwo` and `SelectTwoMany`

Open
#1,734 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Motivation

Currently into_tuple only works on single Select queries. This leads to inconsistencies between the different query types and as such it should be extended to support the SelectTwo and SelectTwoMany queries.

Code like this should work

let res = Email::find_by_id(email_id)
        .select_only()
        .find_also_related(Thread)
        .column(thread::Column::Id)
        .into_tuple()
        .one(db)
        .await?;

Proposed Solutions

into_tuple should work the same as it currently does with Select

Current Workarounds

Currently you can query normally and get a struct in return but getting a tuple directly could help reduce code verbosity.

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 locating the existing into_tuple implementation for Select, then inspect the SelectTwo and SelectTwoMany query entry points. Compare their behavior with Select and identify the relevant tests or examples for tuple results. Done means the shown find_also_related query can call into_tuple and return the expected tuple result.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.