1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

orm: fix time (#11026)

This commit is contained in:
Louis Schmieder
2021-08-03 04:17:00 +02:00
committed by GitHub
parent 6dcf72fe9b
commit a55ba08fad
7 changed files with 52 additions and 15 deletions

View File

@@ -140,7 +140,8 @@ fn (stmt Stmt) sqlite_select_column(idx int, typ int) ?orm.Primitive {
} else if typ == orm.string {
primitive = stmt.get_text(idx).clone()
} else if typ == orm.time {
primitive = time.unix(stmt.get_int(idx))
d := stmt.get_int(idx)
primitive = time.unix(d)
} else {
return error('Unknown type $typ')
}
@@ -149,7 +150,7 @@ fn (stmt Stmt) sqlite_select_column(idx int, typ int) ?orm.Primitive {
}
fn sqlite_type_from_v(typ int) ?string {
return if typ in orm.nums || typ < 0 || typ in orm.num64 {
return if typ in orm.nums || typ < 0 || typ in orm.num64 || typ == orm.time {
'INTEGER'
} else if typ in orm.float {
'REAL'