go-jet / jet

Type safe SQL builder with code generation and automatic query result data mapping
Apache License 2.0
2.23k stars 110 forks source link

[sqlite] GENERATED columns not being recognized #300

Closed go-jet closed 4 months ago

go-jet commented 6 months ago

Discussed in https://github.com/go-jet/jet/discussions/297

Originally posted by **yuphing-ong** December 14, 2023 I tried a table like this: ``` CREATE TABLE test ( jvalues TEXT NOT NULL, -- virtual column for json extracted column to be indexed column1 STRING GENERATED ALWAYS as (JSON_EXTRACT(jvalues, "$.column1")) STORED, ); ``` but go-jet only generates this model (and associated table): ``` type TEST struct { Jvalues string } ``` I tried both virtual and stored, in case go-jet needed it to be STORED but no difference. Is this a limitation of the driver, or go-jet?
go-jet commented 6 months ago

It turned out to be a small change. I've made a fix on sqlite_gen_col branch.

go-jet commented 4 months ago

Sqlite support for generated columns added in Release v2.11.0.