Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyFeedEdit(edit FeedEdit) func(*Feed) EntityUpdate
- func CategoryApplyEdit(edit CategoryEdit) (func(*Category) EntityUpdate, error)
- func FeedMergeGofeed(gfe *gofeed.Feed) func(*Feed) EntityUpdate
- func FeedSetFetchFailed(t time.Time) func(f *Feed) EntityUpdate
- func ItemSetRead(read bool) func(*Item) EntityUpdate
- type Category
- type CategoryEdit
- type Entity
- type EntityUpdate
- type Feed
- type FeedEdit
- type Item
Constants ¶
const CategorySelectColumns string = `` /* 172-byte string literal not displayed */
CategorySelectColumns is used by the database when reading categories
const FeedSelectColumns string = `` /* 168-byte string literal not displayed */
FeedSelectColumns is used by the database when reading feeds
const ItemInsertColumns string = `feedid,
key,
title,
url,
content,
timestamp,
commit_timestamp`
ItemInsertColumns are the columns used at insertion time
const ItemInsertPlaceholders string = "?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP"
ItemInsertPlaceholders are the placeholders used at insertion time
const ItemSelectColumns string = `
items.id,
items.feedid,
items.title,
items.url,
items.timestamp,
items.read,
items.commit_timestamp`
ItemSelectColumns is used by the database when reading items
Variables ¶
var CategoryNameRE = regexp.MustCompile(`^[a-z][a-z0-9-]+$`)
CategoryNameRE is the regular expression matching all valid category names
Functions ¶
func ApplyFeedEdit ¶
func ApplyFeedEdit(edit FeedEdit) func(*Feed) EntityUpdate
ApplyFeedEdit returns a mutation function that applies the given edit
func CategoryApplyEdit ¶
func CategoryApplyEdit(edit CategoryEdit) ( func(*Category) EntityUpdate, error)
CategoryApplyEdit returns a mutation function that applies the given CategoryEdit to a category after validating it.
func FeedMergeGofeed ¶
func FeedMergeGofeed(gfe *gofeed.Feed) func(*Feed) EntityUpdate
FeedMergeGofeed returns a mutation function that merges in updates from the latest fetched version of the feed.
func FeedSetFetchFailed ¶
func FeedSetFetchFailed(t time.Time) func(f *Feed) EntityUpdate
FeedSetFetchFailed is a mutation function that marks a feed as failing
func ItemSetRead ¶
func ItemSetRead(read bool) func(*Item) EntityUpdate
ItemSetRead returns a mutation function that sets an item as read
Types ¶
type Category ¶
type Category struct {
// contains filtered or unexported fields
}
Category is a grouping of feeds. Feeds can be in at most one category. Categories do not affect the backend at all.
func ScanCategories ¶
ScanCategories converts multiple rows into categories
func ScanCategory ¶
ScanCategory converts one row into a category
func (*Category) MarshalJSON ¶
MarshalJSON is used by the JSON marshaller
type CategoryEdit ¶
type CategoryEdit struct { // Categories can never be un-disabled Disabled bool `json:"disabled"` Name *string `json:"name"` Title *string `json:"title"` HiddenMain *bool `json:"hiddenMain"` }
CategoryEdit represents new values for a category from a user edit.
type EntityUpdate ¶
type EntityUpdate struct {
// contains filtered or unexported fields
}
EntityUpdate holds the SQL needed to update (but not insert) an entity
func CategorySetSortPosition ¶
func CategorySetSortPosition(c *Category, sortPos int64) EntityUpdate
CategorySetSortPosition mutates a category to change the sort position.
func FeedSetFetchSuccess ¶
func FeedSetFetchSuccess(f *Feed) EntityUpdate
FeedSetFetchSuccess return a mutation function that marks a feed as succeeding
func (EntityUpdate) Get ¶
func (eu EntityUpdate) Get() (string, []interface{})
Get returns the contents of the EntityUpdate
func (EntityUpdate) Noop ¶
func (eu EntityUpdate) Noop() bool
Noop returns whether this update is a no-op that should not be written
func (EntityUpdate) String ¶
func (eu EntityUpdate) String() string
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
Feed represents a single RSS feed
func (*Feed) MarshalJSON ¶
MarshalJSON is used by the JSON marshaller
type FeedEdit ¶
type FeedEdit struct { CategoryID *int64 `json:"categoryId"` ClearCategory bool `json:"clearCategory"` Disabled *bool `json:"disabled"` UserTitle *string `json:"userTitle"` }
FeedEdit represents new values for a feed from a user edit
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents a single entry in an RSS feed
func CreateNewItems ¶
CreateNewItems creates items without proper IDs, which may be duplicates of Items already present in the database. These should be inserted or ignored into the database then discarded.
func (*Item) InsertValues ¶
func (it *Item) InsertValues() []interface{}
InsertValues returns the values to be inserted into the database, except for "read" which depends on a config setting.
func (*Item) MarshalJSON ¶
MarshalJSON is used by the JSON marshaller Content is excluded and must be fetched separately to cut down on data