This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
bactdb/datastore/datastore_test.go
2014-12-06 14:55:35 -09:00

24 lines
459 B
Go

package datastore
import (
"fmt"
"time"
"github.com/lib/pq"
"github.com/thermokarst/bactdb/models"
)
func normalizeTime(t ...interface{}) {
for _, v := range t {
switch u := v.(type) {
default:
fmt.Printf("unexpected type %T", u)
case *time.Time:
x, _ := v.(*time.Time)
*x = x.In(time.UTC)
case *models.NullTime:
x, _ := v.(*models.NullTime)
*x = models.NullTime{pq.NullTime{Time: x.Time.In(time.UTC), Valid: x.Valid}}
}
}
}