model

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package model provides the data types used across the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	ID             int64         `json:"id,omitempty"`
	Title          string        `json:"title"`
	URL            *url.URL      `json:"url"`
	Homepage       *url.URL      `json:"homepage"`
	UpdateInterval time.Duration `json:"interval"`
	LastRefresh    time.Time     `json:"last_refresh,omitempty"`
	Active         bool          `json:"active,omitempty"`
}

Feed is an RSS feed. Duh.

func (*Feed) Clone

func (f *Feed) Clone() *Feed

Clone returns a shallow copy of the Feed

func (*Feed) IsDue

func (f *Feed) IsDue() bool

IsDue returns true if the Feed is due for a refresh.

func (*Feed) String

func (f *Feed) String() string

type Item

type Item struct {
	ID          int64     `json:"id"`
	FeedID      int64     `json:"feed_id"`
	URL         *url.URL  `json:"url"`
	Timestamp   time.Time `json:"timestamp"`
	Headline    string    `json:"headline"`
	Description string    `json:"description"`
	Rating      int8      `json:"rating"`
	Guessed     int8      `json:"guessed"`
	Tags        []*Tag    `json:"tags"`
	// contains filtered or unexported fields
}

Item is a single news item

func (*Item) EffectiveRating added in v0.2.0

func (i *Item) EffectiveRating() int8

EffectiveRating returns the Item's Rating, *if* it has been rated, the guessed Rating, if one is stored in the Item, else zero.

func (*Item) HasTag added in v0.6.0

func (i *Item) HasTag(id int64) bool

HasTag returns true if the Tag with the given id is found in the Item's list of Tags.

func (*Item) IDString added in v0.2.0

func (i *Item) IDString() string

IDString returns the ID as a string

func (*Item) Plaintext added in v0.2.0

func (i *Item) Plaintext() string

Plaintext returns the complete text of the Item, cleansed of any HTML.

type Search struct {
	ID             int64        `json:"id"`
	Title          string       `json:"title"`
	TimeCreated    time.Time    `json:"time_created"`
	TimeStarted    time.Time    `json:"time_started"`
	TimeFinished   time.Time    `json:"time_finished"`
	Status         bool         `json:"status"`
	Message        string       `json:"message"`
	Tags           []int64      `json:"tags"`
	TagsAll        bool         `json:"tags_all"`
	FilterByPeriod bool         `json:"filter_by_period"`
	FilterPeriod   [2]time.Time `json:"filter_period"`
	QueryString    string       `json:"query_string"`
	Regex          bool         `json:"regexp"`
	Results        []*Item      `json:"results"`
	// contains filtered or unexported fields
}

Search represents the parameters of a search query. Regex, if true, indicates the Query text should be handled as a regular expression. TagsAll, if true, indicates the query is looking for Items that have ALL the supplied Tags linked to them.

func (*Search) IsFinished added in v0.14.0

func (s *Search) IsFinished() bool

IsFinished returns true if the Search query has a Finished timestamp that is later than its Started timestamp.

func (*Search) Match added in v0.14.0

func (s *Search) Match(item *Item) bool

Match returns true if the Search QueryString matches the givem Item. If the Search also filters by period, the Item's Timestamp is checked first.

type Tag added in v0.3.0

type Tag struct {
	ID       int64  `json:"id"`
	Parent   int64  `json:"parent,omitempty"`
	Name     string `json:"name"`
	Level    int64  `json:"level"`
	FullName string `json:"full_name"`
}

Tag is a label that can be attached to an Item. A Tag can also have a Parent Tag, which allows to organize them in a hierarchy.

Jump to

Keyboard shortcuts

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