s1llyw0rdz/model/status.go
2021-11-22 09:05:57 +01:00

24 lines
339 B
Go

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")
}