package model import ( "errors" "time" ) type Status struct { Id int64 User string Content string CreatedAt time.Time } func (s Status) Validate() error { if len(s.Content) == 0 { return errors.New("content is empty") } return nil } func (s Status) Date() string { return s.CreatedAt.Format("2006-01-02") }