sqlboiler
sqlboiler copied to clipboard
sqlite3 driver doesn't seem to generate proper code for 'time' type
If you're having a generation problem please answer these questions before submitting your issue. Thanks!
What version of SQLBoiler are you using (sqlboiler --version)?
SQLBoiler v4.11.0
What is your database and version (eg. Postgresql 10)
sqlite3 3.38.0
If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)
sqlboiler --wipe sqlite3
If this happened at runtime what code produced the issue? (if not applicable leave blank)
What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)
Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
drop table if exists viewlog;
create table viewlog (
logno integer primary key,
userhash text not null,
passage text not null,
ts time not null
);
Further information. What did you do, what did you expect?
The code generation succeeded, but the build failed:
$ go test -p 1 -v ./btdb/
btdb/viewlog.go:452:23: cannot use o.CreatedAt (variable of type string) as type driver.Valuer in argument to queries.MustTime:
string does not implement driver.Valuer (missing Value method)
btdb/viewlog.go:453:23: cannot use &o.CreatedAt (value of type *string) as type sql.Scanner in argument to queries.SetScanner:
*string does not implement sql.Scanner (missing Scan method)
btdb/viewlog.go:666:23: cannot use o.CreatedAt (variable of type string) as type driver.Valuer in argument to queries.MustTime:
string does not implement driver.Valuer (missing Value method)
btdb/viewlog.go:667:23: cannot use &o.CreatedAt (value of type *string) as type sql.Scanner in argument to queries.SetScanner:
*string does not implement sql.Scanner (missing Scan method)
FAIL gitlab.com/[...]/tmp/btdb [build failed]
FAIL
This is likely a semi-simple fix by adding the correct type in this switch statement here.
Not 100% sure when I'd get to it (pretty busy recently), but feel free to send a PR if you need it sooner. (PS: You can switch to your fork while waiting)