Deduplicate params struct if they share the same signature

Aperta
#291 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
postgresql, rust, sql
Ambito
databases

Direzione di ricerca

Start by reading the code that generates parameter structs and look for how it derives their signatures; the issue does not name a file or test. Compare the generated structs for queries with identical fields, then check existing generation tests. Done means equivalent parameter structs are deduplicated while both queries can still use them.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

codegen feature

Migrated from halcyonnouveau/clorinde#82, originally reported by @Folyd on 2025-04-01.

For example:

--! add_category
INSERT INTO
    product_categories (product_id, category_id)
VALUES
    (:product_id, :category_id) ON CONFLICT DO NOTHING;

--! remove_category
DELETE FROM
    product_categories
WHERE
    product_id = :product_id
    AND category_id = :category_id;

This is the generated code, they can be unified into one params struct.

#[derive(Clone, Copy, Debug)]
pub struct AddCategoryParams {
    pub product_id: i32,
    pub category_id: i32,
}
#[derive(Clone, Copy, Debug)]
pub struct RemoveCategoryParams {
    pub product_id: i32,
    pub category_id: i32,
}
Lingua principale
Rust
Stelle
1.2k
Fork
77
Merge medio
5g 12h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cornucopia-rs/cornucopia

Tutte le issue di cornucopia-rs/cornucopia

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.