-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
To avoid big repo.Querier
interfaces, we split our queries into multiple packages. As these repositories use the same database, it uses as well the same migrations.
Once sqlc
generates the files, everything works fine but we end-up with duplicated and un-used structs. On the example below, we would have a struct Foo
in both internal/repository/x
and internal/repository/y
, although only one of the repositories might use it.
It doesn't affect the code generated (it still works), but it might confuse developers when going through the code. Wouldn't it be better to have a flag to clean / not generate structs that are not used by that repository?
version: "1"
packages:
- name: "x"
emit_json_tags: true
emit_interface: true
path: "./internal/repository/x"
queries: "./internal/repository/x/queries/"
schema: "./internal/repository/migrations/"
- name: "y"
emit_json_tags: true
emit_interface: true
path: "./internal/repository/y"
queries: "./internal/repository/y/queries/"
schema: "./internal/repository/migrations/"
CREATE TABLE foo (
id text NOT NULL,
PRIMARY KEY (id)
);
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request