Skip to content

Deduplicate params struct if they share the same signature #291

Description

@LouisGariepy

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,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    codegenAn issue regarding code generation, or the generated code itself.featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions