I am casting to a struct which has a time.Time type in.
t2 := time.Now()
format := "2006-01-02 15:04:05"
theTime, _ := time.Parse(format, t2.Format(format))
However, sometimes I don't want to set the time.Time field, how do you define this with the go/mysql db driver?
app_history := &models.AppsHistoryInsert{
AppId: response.SetAppData[0].Id,
LiveDate: &theTime,
}
Basically, I want
if(x == true) {
include time
}
else {
don't include time.
}
I tried doing an if
around the struct declaration itself and leaving the LiveDate
field out but I got the error of controllers/apps.go:1068: undefined: app_history