I have a struct with a property time:
`type Basket struct {
...
Created_at time.Time -db:"created_at"-// - is in fact single quote
}
with the time saved as:
basket.Created_at = time.Now().UTC()
If I save it using Insert sql statement, it saves the time nicely in the SQLite3 but when I select the desired record using:
ret_basket := Basket{} err := database.DB.Get(&ret_basket, "SELECT id, ..., created_at FROM baskets WHERE user_id = ?", some_user_id)
It returns the record with other properties loaded properly except the time property which is ret_basket.Created_at
as 0001-01-01 00:00:00 +0000 UTC
Any suggestions?
Aucun commentaire:
Enregistrer un commentaire