storage

package
v0.0.0-...-e21216f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusRepresentations = map[ItemStatus]string{
	UNREAD:  "unread",
	READ:    "read",
	STARRED: "starred",
}
View Source
var StatusValues = map[string]ItemStatus{
	"unread":  UNREAD,
	"read":    READ,
	"starred": STARRED,
}

Functions

This section is empty.

Types

type Feed

type Feed struct {
	Id          int64   `json:"id"`
	FolderId    *int64  `json:"folder_id"`
	Title       string  `json:"title"`
	Description string  `json:"description"`
	Link        string  `json:"link"`
	FeedLink    string  `json:"feed_link"`
	Icon        *[]byte `json:"icon,omitempty"`
	HasIcon     bool    `json:"has_icon"`
}

type FeedStat

type FeedStat struct {
	FeedId       int64 `json:"feed_id"`
	UnreadCount  int64 `json:"unread"`
	StarredCount int64 `json:"starred"`
}

type Folder

type Folder struct {
	Id         int64  `json:"id"`
	Title      string `json:"title"`
	IsExpanded bool   `json:"is_expanded"`
}

type HTTPState

type HTTPState struct {
	FeedID        int64
	LastRefreshed time.Time

	LastModified string
	Etag         string
}

type Item

type Item struct {
	Id       int64      `json:"id"`
	GUID     string     `json:"guid"`
	FeedId   int64      `json:"feed_id"`
	Title    string     `json:"title"`
	Link     string     `json:"link"`
	Content  string     `json:"content,omitempty"`
	Date     time.Time  `json:"date"`
	Status   ItemStatus `json:"status"`
	ImageURL *string    `json:"image"`
	AudioURL *string    `json:"podcast_url"`
}

type ItemFilter

type ItemFilter struct {
	FolderID *int64
	FeedID   *int64
	Status   *ItemStatus
	Search   *string
	After    *int64
}

type ItemStatus

type ItemStatus int
const (
	UNREAD  ItemStatus = 0
	READ    ItemStatus = 1
	STARRED ItemStatus = 2
)

func (ItemStatus) MarshalJSON

func (s ItemStatus) MarshalJSON() ([]byte, error)

func (*ItemStatus) UnmarshalJSON

func (s *ItemStatus) UnmarshalJSON(b []byte) error

type MarkFilter

type MarkFilter struct {
	FolderID *int64
	FeedID   *int64
}

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

func New

func New(path string) (*Storage, error)

func (*Storage) CreateFeed

func (s *Storage) CreateFeed(title, description, link, feedLink string, folderId *int64) *Feed

func (*Storage) CreateFolder

func (s *Storage) CreateFolder(title string) *Folder

func (*Storage) CreateItems

func (s *Storage) CreateItems(items []Item) bool

func (*Storage) DeleteFeed

func (s *Storage) DeleteFeed(feedId int64) bool

func (*Storage) DeleteFolder

func (s *Storage) DeleteFolder(folderId int64) bool

func (*Storage) DeleteOldItems

func (s *Storage) DeleteOldItems()

Delete old articles from the database to cleanup space.

The rules:

  • Never delete starred entries.
  • Keep at least the same amount of articles the feed provides (default: 50). This prevents from deleting items for rarely updated and/or ever-growing feeds which might eventually reappear as unread.
  • Keep entries for a certain period (default: 90 days).

func (*Storage) FeedStats

func (s *Storage) FeedStats() []FeedStat

func (*Storage) GetFeed

func (s *Storage) GetFeed(id int64) *Feed

func (*Storage) GetFeedErrors

func (s *Storage) GetFeedErrors() map[int64]string

func (*Storage) GetHTTPState

func (s *Storage) GetHTTPState(feedID int64) *HTTPState

func (*Storage) GetItem

func (s *Storage) GetItem(id int64) *Item

func (*Storage) GetSettings

func (s *Storage) GetSettings() map[string]interface{}

func (*Storage) GetSettingsValue

func (s *Storage) GetSettingsValue(key string) interface{}

func (*Storage) GetSettingsValueInt64

func (s *Storage) GetSettingsValueInt64(key string) int64

func (*Storage) ListFeeds

func (s *Storage) ListFeeds() []Feed

func (*Storage) ListFeedsMissingIcons

func (s *Storage) ListFeedsMissingIcons() []Feed

func (*Storage) ListFolders

func (s *Storage) ListFolders() []Folder

func (*Storage) ListHTTPStates

func (s *Storage) ListHTTPStates() map[int64]HTTPState

func (*Storage) ListItems

func (s *Storage) ListItems(filter ItemFilter, limit int, newestFirst bool) []Item

func (*Storage) MarkItemsRead

func (s *Storage) MarkItemsRead(filter MarkFilter) bool

func (*Storage) RenameFeed

func (s *Storage) RenameFeed(feedId int64, newTitle string) bool

func (*Storage) RenameFolder

func (s *Storage) RenameFolder(folderId int64, newTitle string) bool

func (*Storage) ResetFeedErrors

func (s *Storage) ResetFeedErrors()

func (*Storage) SetFeedError

func (s *Storage) SetFeedError(feedID int64, lastError error)

func (*Storage) SetFeedSize

func (s *Storage) SetFeedSize(feedId int64, size int)

func (*Storage) SetHTTPState

func (s *Storage) SetHTTPState(feedID int64, lastModified, etag string)

func (*Storage) SyncSearch

func (s *Storage) SyncSearch()

func (*Storage) ToggleFolderExpanded

func (s *Storage) ToggleFolderExpanded(folderId int64, isExpanded bool) bool

func (*Storage) UpdateFeedFolder

func (s *Storage) UpdateFeedFolder(feedId int64, newFolderId *int64) bool

func (*Storage) UpdateFeedIcon

func (s *Storage) UpdateFeedIcon(feedId int64, icon *[]byte) bool

func (*Storage) UpdateItemStatus

func (s *Storage) UpdateItemStatus(item_id int64, status ItemStatus) bool

func (*Storage) UpdateSettings

func (s *Storage) UpdateSettings(kv map[string]interface{}) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL