Go json cannot unmarshal Duration from a string, thus this hack.
(delta string)
| 412 | |
| 413 | // Go json cannot unmarshal Duration from a string, thus this hack. |
| 414 | func getCreatedTime(delta string) time.Time { |
| 415 | dd, err := time.ParseDuration(delta) |
| 416 | if err != nil && delta != "" { |
| 417 | log.Fatal("Invalid duration string", delta) |
| 418 | } |
| 419 | |
| 420 | return time.Now().UTC().Round(time.Millisecond).Add(dd) |
| 421 | } |
| 422 | |
| 423 | type photoStruct struct { |
| 424 | Type string `json:"type" db:"type"` |