s1llyw0rdz/model/status.go

25 lines
339 B
Go
Raw Normal View History

2021-11-22 08:05:57 +00:00
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")
}