Closed
Description
Version
v1.17.2
What happened?
When override table column with imported type as pointer - type is not imports in queries.sql.go
example
override with type github.com/some/package/types.CustomTypeName
as pointer
https://play.sqlc.dev/p/ed5f9342ff8eda757c7bb8d1da9b27a94a734e2b98a6c8f73d08a10736ae9dae
{
"import": "github.com/some/package/types",
"type": "CustomTypeName",
"pointer": true
}
generates query.sql.go
without override type import:
package model
import (
"context"
"github.com/google/uuid"
)
valid example
same override without pointer flag
https://play.sqlc.dev/p/19de6fe73aa60dba17237db3f83530cf2ad3c4b8fb61c891b12ec3143496cff9
{
"import": "github.com/some/package/types",
"type": "CustomTypeName"
}
generates query.sql.go
with valid import:
package model
import (
"context"
"github.com/google/uuid"
"github.com/some/package/types"
)
Relevant log output
No response
Database schema
create table vendors
(
id uuid primary key,
data jsonb
);
SQL queries
/* name: GetVendors :one */
SELECT v.*, 'something' as custom FROM vendors v;
Configuration
{
"version": "2",
"sql": [
{
"schema": "query.sql",
"queries": "query.sql",
"engine": "postgresql",
"gen": {
"go": {
"package": "model",
"out": "db",
"overrides": [
{
"column": "vendors.data",
"go_type": {
"import": "github.com/some/package/types",
"type": "CustomTypeName",
"pointer": true
},
"nullable": true
}
]
}
}
}
]
}
Playground URL
https://play.sqlc.dev/p/ed5f9342ff8eda757c7bb8d1da9b27a94a734e2b98a6c8f73d08a10736ae9dae
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go