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 generating some queries for some extracted JSON data on SQLite, the generated query row model uses interface{} instead of time.Time.
I reproduced with the following query: SELECT id, DATETIME(data ->> createdAt) as created_at FROM authors;
Which produces:
type GetAuthorRow struct {
ID string
CreatedAt interface{}
}
I've tried casting the output but SQLite only supports basic casting: https://www.sqlite.org/lang_expr.html#castexpr
Using DATETIME with CAST(DATETIME(data ->> createdAt) AS DATETIME)` results in the correct type being generated on go side with SQLC, but the data is not correctly extracted from the SQLite database.
I also tried to use the overrides with no sucess as I'm not dealing with existing SQLite columns but "generating" them with the queries.
Relevant log output
No response
Database schema
CREATETABLEauthors (
id textPRIMARY KEY,
data text
);
SQL queries
SELECT id, DATETIME(data ->> createdAt) as created_at FROM authors;
Version
1.26.0
What happened?
When generating some queries for some extracted JSON data on SQLite, the generated query row model uses
interface{}
instead oftime.Time
.I reproduced with the following query:
SELECT id, DATETIME(data ->> createdAt) as created_at FROM authors;
Which produces:
I've tried casting the output but SQLite only supports basic casting: https://www.sqlite.org/lang_expr.html#castexpr
Using
DATETIME
with CAST(DATETIME(data ->> createdAt) AS DATETIME)` results in the correct type being generated on go side with SQLC, but the data is not correctly extracted from the SQLite database.I also tried to use the overrides with no sucess as I'm not dealing with existing SQLite columns but "generating" them with the queries.
Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/596c5ead0510249c37a5f0aefda2441ce806c9ed7827e361b6568b0e1f18fe93
What operating system are you using?
Linux, macOS
What database engines are you using?
SQLite
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: