Functions created for Postgres are not generating fields for returned row structs. For example:
type TestFuncSelectBlogRow struct {
}
I suspect that I'm doing something wrong, but I can't seem to figure this out. Any help would be greatly appreciated. Thank you in advance.
Relevant log output
const testFuncGetTime = `-- name: TestFuncGetTime :one
select from test_fuct_get_time($1)
`
type TestFuncGetTimeParams struct {
TestFuctGetTime interface{} `json:"testFuctGetTime"`
}
type TestFuncGetTimeRow struct {
}
func (q *Queries) TestFuncGetTime(ctx context.Context, arg TestFuncGetTimeParams) (TestFuncGetTimeRow, error) {
row := q.db.QueryRow(ctx, testFuncGetTime, arg.TestFuctGetTime)
var i TestFuncGetTimeRow
err := row.Scan()
return i, err
}
const testFuncSelectBlog = `-- name: TestFuncSelectBlog :one
select from test_func_select_blog($1)
`
type TestFuncSelectBlogParams struct {
TestFuncSelectBlog interface{} `json:"testFuncSelectBlog"`
}
type TestFuncSelectBlogRow struct {
}
func (q *Queries) TestFuncSelectBlog(ctx context.Context, arg TestFuncSelectBlogParams) (TestFuncSelectBlogRow, error) {
row := q.db.QueryRow(ctx, testFuncSelectBlog, arg.TestFuncSelectBlog)
var i TestFuncSelectBlogRow
err := row.Scan()
return i, err
}
const testFuncSelectString = `-- name: TestFuncSelectString :one
select from test_func_select_string($1)
`
type TestFuncSelectStringParams struct {
TestFuncSelectString interface{} `json:"testFuncSelectString"`
}
type TestFuncSelectStringRow struct {
}
func (q *Queries) TestFuncSelectString(ctx context.Context, arg TestFuncSelectStringParams) (TestFuncSelectStringRow, error) {
row := q.db.QueryRow(ctx, testFuncSelectString, arg.TestFuncSelectString)
var i TestFuncSelectStringRow
err := row.Scan()
return i, err
}
Database schema
create function test_func_get_time ()
returns timestamp AS $$
Begin
return now();
End;
$$ language plpgsql;
create function test_select_string (in p_string text)
returns text AS $$
Begin
return p_string;
End;
$$ language plpgsql;
create function test_select_blog(in p_id int)
returns table (id int, name text, created_at timestamp, updated_at timestamp) AS $$
BEGIN RETURN QUERY
select id, name, created_at, updated_at from blog where id = p_id;
END;
$$ language plpgsql;
SQL queries
-- name: TestFuncGetTime :one
select * from test_fuct_get_time($1);
-- name: TestFuncSelectString :one
select * from test_func_select_string($1);
-- name: TestFuncSelectBlog :one
select * from test_func_select_blog($1);
Version
1.18.0
What happened?
Functions created for Postgres are not generating fields for returned row structs. For example:
I suspect that I'm doing something wrong, but I can't seem to figure this out. Any help would be greatly appreciated. Thank you in advance.
Relevant log output
Database schema
SQL queries
Configuration
No response
Playground URL
https://play.sqlc.dev/p/f91c263ba2690afce4165f4febce483987995c3ba53e96a8f40bcd7e0af5fbc8
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go