category.go 865 B

1234567891011121314151617181920212223242526272829303132
  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 "fmt"
  6. // Category represents a feed category.
  7. type Category struct {
  8. ID int64 `json:"id"`
  9. Title string `json:"title"`
  10. UserID int64 `json:"user_id"`
  11. FeedCount int `json:"-"`
  12. }
  13. func (c *Category) String() string {
  14. return fmt.Sprintf("ID=%d, UserID=%d, Title=%s", c.ID, c.UserID, c.Title)
  15. }
  16. // CategoryRequest represents the request to create or update a category.
  17. type CategoryRequest struct {
  18. Title string `json:"title"`
  19. }
  20. // Patch updates category fields.
  21. func (cr *CategoryRequest) Patch(category *Category) {
  22. category.Title = cr.Title
  23. }
  24. // Categories represents a list of categories.
  25. type Categories []*Category