diff --git a/model/status.go b/model/status.go index b2bf359..54694ad 100644 --- a/model/status.go +++ b/model/status.go @@ -16,7 +16,7 @@ type Status struct { Content string Face string CreatedAt time.Time - Number int `json:"number"` + Number int `db:"number" json:"number"` } var urlRegexp = regexp.MustCompile(`https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`) @@ -34,7 +34,7 @@ func (s Status) ContentDisplay() string { if userRegexp.MatchString(s.Content) { matches := userRegexp.FindAllStringSubmatch(s.Content, -1) for _, m := range matches { - content = strings.Replace(content, m[0], fmt.Sprintf("%s", m[1], m[0]), 1) + content = strings.Replace(content, m[0], fmt.Sprintf("%s", m[1], m[0]), 1) } } return content @@ -45,8 +45,8 @@ func (s Status) ContentHtml() template.HTML { } func (s Status) Validate() error { - if len(s.Content) == 0 { - return errors.New("content is empty") + if s.Number == 0 { + return errors.New("u gotta add a count man") } return nil }