article.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package models
  2. import (
  3. "database/sql"
  4. "time"
  5. )
  6. type ArticlePreview struct {
  7. ID int
  8. URL string
  9. Title string
  10. PublishTime time.Time
  11. PreviewText sql.NullString
  12. Image sql.NullString
  13. }
  14. type Article struct {
  15. ID int
  16. URL string
  17. Title string
  18. PublishTime time.Time
  19. Text string
  20. PreviewText sql.NullString
  21. IsActive bool
  22. Image sql.NullString
  23. MetaKeywords sql.NullString
  24. MetaDescription sql.NullString
  25. }
  26. type ArticleForm struct {
  27. ID int
  28. Title string `form:"title" validate:"required,max=255"`
  29. Image string `form:"image" validate:"uri,max=255"`
  30. URL string `form:"url" validate:"required,max=255"`
  31. Text string `form:"text" validate:"required"`
  32. PreviewText string `form:"preview_text" validate:"max=255"`
  33. MetaKeywords string `form:"meta_keywords" validate:"max=255"`
  34. MetaDescription string `form:"meta_description" validate:"max=255"`
  35. IsActive bool `form:"is_active"`
  36. PublishTime string `form:"publish_time" validate:"required"`
  37. Tags []string `form:"tag"`
  38. ActiveTags map[int]bool
  39. }