Closed
Description
Version
1.15.0
What happened?
Type overrides specified by column name have no effect when using SQLite as the engine. The same config works with MySQL.
Check out the UUID column in the following playgrounds (snippets pasted below as well):
SQLite playground showing bugged result
MySQL playground showing desired result
The resulting struct with SQLite (no type override applied, it uses the default sql.NullString
):
type Author struct {
ID int64
Name string
Uuid sql.NullString
}
And with MySQL (it used UUID this time correctly):
type Author struct {
ID int32
Name string
Uuid uuid.UUID
}
Relevant log output
No response
Database schema
CREATE TABLE authors (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
uuid TEXT
);
SQL queries
No response
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "sqlite",
"schema": "query.sql",
"queries": "query.sql"
}
],
"overrides": [
{
"column": "authors.uuid",
"go_type": "github.com/gofrs/uuid.UUID",
"nullable": true
}
]
}
Playground URL
https://play.sqlc.dev/p/2c63b17ce6f6fe25e987ef9af4175641d1c9d3607be33cf4a86188b08a09f4dd
What operating system are you using?
Windows
What database engines are you using?
No response
What type of code are you generating?
Go