feed.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package model
  5. import (
  6. "fmt"
  7. "time"
  8. )
  9. // Feed represents a feed in the database.
  10. type Feed struct {
  11. ID int64 `json:"id"`
  12. UserID int64 `json:"user_id"`
  13. FeedURL string `json:"feed_url"`
  14. SiteURL string `json:"site_url"`
  15. Title string `json:"title"`
  16. CheckedAt time.Time `json:"checked_at"`
  17. EtagHeader string `json:"etag_header"`
  18. LastModifiedHeader string `json:"last_modified_header"`
  19. ParsingErrorMsg string `json:"parsing_error_message"`
  20. ParsingErrorCount int `json:"parsing_error_count"`
  21. ScraperRules string `json:"scraper_rules"`
  22. RewriteRules string `json:"rewrite_rules"`
  23. Crawler bool `json:"crawler"`
  24. Username string `json:"username"`
  25. Password string `json:"password"`
  26. Category *Category `json:"category,omitempty"`
  27. Entries Entries `json:"entries,omitempty"`
  28. Icon *FeedIcon `json:"icon"`
  29. }
  30. func (f *Feed) String() string {
  31. return fmt.Sprintf("ID=%d, UserID=%d, FeedURL=%s, SiteURL=%s, Title=%s, Category={%s}",
  32. f.ID,
  33. f.UserID,
  34. f.FeedURL,
  35. f.SiteURL,
  36. f.Title,
  37. f.Category,
  38. )
  39. }
  40. // Feeds is a list of feed
  41. type Feeds []*Feed