What do you want to change?
Say we have two queries with JOINs:
-- name: SelectOneFileByID :one
SELECT f.id, f.name, b.size
FROM file f
JOIN blob b
ON f.blob_id == b.id
WHERE f.id == $1;
-- name: SelectOneFileByName :one
SELECT f.id, f.name, b.size
FROM file f
JOIN blob b
ON f.blob_id == b.id
WHERE f.name == $1;
This will generate two structs in Go:
SelectOneFileByID
SelectOneFileByName
I want single type: SelectOneFile because struct's generated by sqlc are of same shape, no need to generate data-type per query, there should be a way to override this semantics.
What could be done? I thought it could be done with plugin, but there are nearly zero docs about plugins and looking at code I don't think plugins could solve this because they are not middlewares in the "data transformation pipeline" (I would be happy if there is some place I could inject custom code to transform Go's AST considering some annotations in SQL for example)
What database engines need to be changed?
Postgresql
What programming language backends need to be changed?
Go
What do you want to change?
Say we have two queries with
JOINs:This will generate two structs in Go:
SelectOneFileByIDSelectOneFileByNameI want single type:
SelectOneFilebecausestruct's generated bysqlcare of same shape, no need to generate data-type per query, there should be a way to override this semantics.What could be done? I thought it could be done with plugin, but there are nearly zero docs about plugins and looking at code I don't think plugins could solve this because they are not middlewares in the "data transformation pipeline" (I would be happy if there is some place I could inject custom code to transform Go's AST considering some annotations in SQL for example)
What database engines need to be changed?
Postgresql
What programming language backends need to be changed?
Go