Closed
Description
Version
1.21.0
What happened?
When query_parameter_limit > 0
and emit_pointers_for_null_types
is set to true
sqlc generates parameter type of DB engine specific time type instead of *time.Time
:
pgx/v5: func (q *Queries) UpdateLoginTime(ctx context.Context, uid uuid.UUID, lastLogin pgtype.Timestamptz) (User, error) {
I expect type for lastLogin
to be *time.Time
.
Database schema
CREATE TABLE IF NOT EXISTS users
(
id SERIAL PRIMARY KEY,
first_login timestamp with time zone,
last_login timestamp with time zone
);
SQL queries
-- name: UpdateLoginTime :one
UPDATE users
SET first_login = CASE WHEN first_login IS NULL THEN $2 END,
last_login = $2
WHERE uid = $1
RETURNING *;
Configuration
version: "2"
sql:
- engine: "postgresql"
queries: "storage"
schema: "storage/migrations"
gen:
go:
sql_package: "pgx/v5"
package: "db"
out: "db"
emit_json_tags: true
emit_pointers_for_null_types: true
json_tags_case_style: camel
query_parameter_limit: 5
overrides:
- db_type: "uuid"
go_type: "github.com/gofrs/uuid.UUID"
- go_struct_tag: "json:\"-\""
column: "*.password"
Playground URL
No response
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go