feed.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 // import "miniflux.app/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. UserAgent string `json:"user_agent"`
  25. Username string `json:"username"`
  26. Password string `json:"password"`
  27. Category *Category `json:"category,omitempty"`
  28. Entries Entries `json:"entries,omitempty"`
  29. Icon *FeedIcon `json:"icon"`
  30. }
  31. func (f *Feed) String() string {
  32. return fmt.Sprintf("ID=%d, UserID=%d, FeedURL=%s, SiteURL=%s, Title=%s, Category={%s}",
  33. f.ID,
  34. f.UserID,
  35. f.FeedURL,
  36. f.SiteURL,
  37. f.Title,
  38. f.Category,
  39. )
  40. }
  41. // Feeds is a list of feed
  42. type Feeds []*Feed