package models import "time" // A Log represents a log session. type Log struct { ID string `json:"id"` Date time.Time `json:"date"` ChannelName string `json:"channelName"` Title string `json:"title"` EventName string `json:"eventName"` Description string `json:"description"` Open bool `json:"open"` Posts []Post `json:"posts"` } // LatestTime gets the latest timestamp in the log. func (log *Log) LatestTime() time.Time { if len(log.Posts) == 0 { return log.Date } latest := log.Date for _, post := range log.Posts { if post.Time.After(latest) { latest = post.Time } } return latest }