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

Co-authored-by: Merlin Diavova <md@merlindiaova.org>
master
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
1 changed files with 5 additions and 0 deletions

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))
}