article.go 1.2 KB

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