Open corpix opened 1 year ago
In the same boat. This following are valid SQL:
select (table_a.*)::table_b from table_a;
select (table_a.id, table_a.name, table_a.size)::table_b from table_a;
But generating go code from them produces a []interface[]
result parameter. Seems like the cast could be a hint to use the model type for the other table.
What do you want to change?
Say we have two queries with
JOIN
s:This will generate two structs in Go:
SelectOneFileByID
SelectOneFileByName
I want single type:
SelectOneFile
becausestruct
's generated bysqlc
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