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

pg: resolve PG string datetime values to V time.Time ones (#14336)

Co-authored-by: Merlin Diavova <md@merlindiaova.org>
This commit is contained in:
Merlin Diavova 2022-05-08 12:37:46 +00:00 committed by GitHub
parent 650fb493bd
commit 106487d62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,6 +266,11 @@ fn str_to_primitive(str string, typ int) ?orm.Primitive {
return orm.Primitive(str)
}
orm.time {
if str.contains_any(' /:-') {
date_time_str := time.parse(str) ?
return orm.Primitive(date_time_str)
}
timestamp := str.int()
return orm.Primitive(time.unix(timestamp))
}