You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a query specifies all columns, the generated function should return the struct from models.go. However, if the column order from the query is not identical to the column order in the table definition, the generated function will instead return a *Row struct.
Relevant log output
// generated code, note it does not return our Test model struct
type TestGetRow struct {
Name string
ID int32
}
func (q *Queries) TestGet(ctx context.Context, id int32) (TestGetRow, error) {
row := q.db.QueryRowContext(ctx, testGet, id)
var i TestGetRow
err := row.Scan(&i.Name, &i.ID)
return i, err
}
Database schema
CREATETABLEIF NOT EXISTS test (
id INTEGERNOT NULLPRIMARY KEY,
name TEXTNOT NULL
);
SQL queries
-- name: TestGet :oneSELECT name, id FROM test WHERE id = $1;
Version
1.26.0
What happened?
When a query specifies all columns, the generated function should return the struct from models.go. However, if the column order from the query is not identical to the column order in the table definition, the generated function will instead return a *Row struct.
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/b9e31f8d197736d3d2bfac8395a0236bce0a7f6bac3b6e3ddfbe54875eabda31
What operating system are you using?
Windows
What database engines are you using?
MySQL, PostgreSQL, SQLite
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: