readeef: github.com/urandom/readeef/content Index | Files | Directories

package content

import "github.com/urandom/readeef/content"

Index

Package Files

article.go err.go extract.go feed.go scores.go subscription.go tag.go thumbnail.go user.go validation.go

Constants

const (
    DefaultSort sortingField = iota
    SortByID
    SortByDate
)
const (
    AscendingOrder sortingOrder = iota
    DescendingOrder
)

Variables

var (
    // ReadOnly sets the query for read articles.
    ReadOnly = QueryOpt{func(o *QueryOptions) {
        o.ReadOnly = true
    }}

    // UnreadOnly sets the query for unread articles.
    UnreadOnly = QueryOpt{func(o *QueryOptions) {
        o.UnreadOnly = true
    }}

    // UnreadFirst sets the query to return unread articles first.
    UnreadFirst = QueryOpt{func(o *QueryOptions) {
        o.UnreadFirst = true
    }}

    // FavoriteOnly sets the query for favorite articles.
    FavoriteOnly = QueryOpt{func(o *QueryOptions) {
        o.FavoriteOnly = true
    }}

    // UntaggedOnly sets the query for untagged articles.
    UntaggedOnly = QueryOpt{func(o *QueryOptions) {
        o.UntaggedOnly = true
    }}

    // IncludeScores sets the query to return articles' score information.
    IncludeScores = QueryOpt{func(o *QueryOptions) {
        o.IncludeScores = true
    }}

    // HighScoredFirst sets the query to return articles with high scores first.
    HighScoredFirst = QueryOpt{func(o *QueryOptions) {
        o.HighScoredFirst = true
    }}
)
var (
    ErrNoContent = errors.New("No content")
)

func IsNoContent Uses

func IsNoContent(err error) bool

func IsValidationError Uses

func IsValidationError(err error) bool

func NewValidationError Uses

func NewValidationError(err error) error

type Article Uses

type Article struct {
    ID     ArticleID      `json:"id"`
    Guid   sql.NullString `json:"-"`
    FeedID FeedID         `db:"feed_id" json:"feedID"`

    Title       string    `json:"title"`
    Description string    `json:"description"`
    Link        string    `json:"link"`
    Date        time.Time `json:"date"`

    Read          bool   `json:"read"`
    Favorite      bool   `json:"favorite"`
    Score         int64  `json:"score,omitempty"`
    Thumbnail     string `json:"thumbnail,omitempty"`
    ThumbnailLink string `db:"thumbnail_link" json:"thumbnailLink,omitempty"`

    IsNew bool `json:"-"`

    Hit struct {
        Fragments map[string][]string `json:"fragments,omitempty"`
    }   `json:"hits"`
}

func (Article) String Uses

func (a Article) String() string

func (Article) Validate Uses

func (a Article) Validate() error

type ArticleExtract Uses

type ArticleExtract struct {
    ArticleID ArticleID
    Title     string
    Content   string
    TopImage  string `db:"top_image"`
    Language  string
}

type ArticleID Uses

type ArticleID int64

func (*ArticleID) Scan Uses

func (id *ArticleID) Scan(src interface{}) error

func (ArticleID) Value Uses

func (id ArticleID) Value() (driver.Value, error)

type Extract Uses

type Extract struct {
    ArticleID ArticleID `db:"article_id"`
    Title     string
    Content   string
    TopImage  string `db:"top_image"`
    Language  string
}

func (Extract) String Uses

func (e Extract) String() string

func (Extract) Validate Uses

func (e Extract) Validate() error

type Feed Uses

type Feed struct {
    ID             FeedID          `json:"id"`
    Title          string          `json:"title"`
    Description    string          `json:"description"`
    Link           string          `json:"link"`
    SiteLink       string          `db:"site_link" json:"-"`
    HubLink        string          `db:"hub_link" json:"-"`
    UpdateError    string          `db:"update_error" json:"updateError"`
    SubscribeError string          `db:"subscribe_error" json:"subscribeError"`
    TTL            time.Duration   `json:"-"`
    SkipHours      map[int]bool    `json:"-"`
    SkipDays       map[string]bool `json:"-"`
    // contains filtered or unexported fields
}

func (*Feed) AddUpdateError Uses

func (f *Feed) AddUpdateError(err string)

func (Feed) ParsedArticles Uses

func (f Feed) ParsedArticles() (a []Article)

func (*Feed) Refresh Uses

func (f *Feed) Refresh(pf parser.Feed)

func (Feed) String Uses

func (f Feed) String() string

func (Feed) Validate Uses

func (f Feed) Validate() error

type FeedID Uses

type FeedID int64

func (*FeedID) Scan Uses

func (id *FeedID) Scan(src interface{}) error

func (FeedID) Value Uses

func (id FeedID) Value() (driver.Value, error)

type Filter Uses

type Filter struct {
    TagID        TagID    `json:"tagID"`
    FeedIDs      []FeedID `json:"feedIDs"`
    InverseFeeds bool     `json:"inverseFeeds"`
    URLTerm      string   `json:"urlTerm"`
    TitleTerm    string   `json:"titleTerm"`
    InverseURL   bool     `json:"inverseURL"`
    InverseTitle bool     `json:"inverseTitle"`
}

func GetUserFilters Uses

func GetUserFilters(u User) []Filter

func (Filter) Valid Uses

func (f Filter) Valid() bool

type Login Uses

type Login string

Login is the user login name.

func (*Login) Scan Uses

func (val *Login) Scan(src interface{}) error

func (Login) Value Uses

func (val Login) Value() (driver.Value, error)

type ProfileData Uses

type ProfileData map[string]interface{}

func (*ProfileData) Scan Uses

func (val *ProfileData) Scan(src interface{}) error

func (*ProfileData) UnmarshalJSON Uses

func (p *ProfileData) UnmarshalJSON(b []byte) error

func (ProfileData) Value Uses

func (val ProfileData) Value() (driver.Value, error)

type QueryOpt Uses

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

QueryOpt is a single query option.

func FeedIDs Uses

func FeedIDs(ids []FeedID) QueryOpt

FeedIDS limits the query to the specified feed ids.

func Filters Uses

func Filters(filters []Filter) QueryOpt

Filters ads configurable filters to limit the query result.

func IDRange Uses

func IDRange(after, before ArticleID) QueryOpt

IDRange sets the valid article ids between the two provided.

func IDs Uses

func IDs(ids []ArticleID) QueryOpt

IDS limits the query to the specified article ids.

func Paging Uses

func Paging(limit, offset int) QueryOpt

Paging sets the article query paging optons.

func ScoreRange Uses

func ScoreRange(after, before int64) QueryOpt

ScoreRange sets the minimum and maximum scores of returned articles.

func Sorting Uses

func Sorting(field sortingField, order sortingOrder) QueryOpt

Sorting sets the query result sorting.

func TimeRange Uses

func TimeRange(after, before time.Time) QueryOpt

TimeRange sets the minimum and maximum times of returned articles.

type QueryOptions Uses

type QueryOptions struct {
    Limit           int
    Offset          int
    ReadOnly        bool
    UnreadOnly      bool
    UnreadFirst     bool
    FavoriteOnly    bool
    UntaggedOnly    bool
    IncludeScores   bool
    HighScoredFirst bool
    BeforeID        ArticleID
    AfterID         ArticleID
    BeforeDate      time.Time
    AfterDate       time.Time
    BeforeScore     int64
    AfterScore      int64
    IDs             []ArticleID
    FeedIDs         []FeedID
    Filters         []Filter

    SortField sortingField
    SortOrder sortingOrder
}

QueryOptions is the full range of options for querying articles.

func (*QueryOptions) Apply Uses

func (o *QueryOptions) Apply(opts []QueryOpt)

Apply applies the settings from the passed opts to the QueryOptions

type Scores Uses

type Scores struct {
    ArticleID ArticleID `db:"article_id"`
    Score     int64
    Score1    int64
    Score2    int64
    Score3    int64
    Score4    int64
    Score5    int64
}

Scores contains the calculated popularity score of an article.

func (Scores) Calculate Uses

func (s Scores) Calculate() int64

Calculate returns the overall score of the article.

func (Scores) String Uses

func (s Scores) String() string

func (Scores) Validate Uses

func (s Scores) Validate() error

Validate validates the score data.

type Subscription Uses

type Subscription struct {
    FeedID              FeedID    `db:"feed_id"`
    Link                string    `db:"link"`
    LeaseDuration       int64     `db:"lease_duration"`
    VerificationTime    time.Time `db:"verification_time"`
    SubscriptionFailure bool      `db:"subscription_failure"`
}

func (Subscription) String Uses

func (s Subscription) String() string

func (Subscription) Validate Uses

func (s Subscription) Validate() error

type Tag Uses

type Tag struct {
    ID    TagID    `json:"id"`
    Value TagValue `json:"value"`
}

func (Tag) String Uses

func (t Tag) String() string

func (Tag) Validate Uses

func (t Tag) Validate() error

type TagID Uses

type TagID int64

func (*TagID) Scan Uses

func (id *TagID) Scan(src interface{}) error

func (TagID) Value Uses

func (id TagID) Value() (driver.Value, error)

type TagValue Uses

type TagValue string

func (*TagValue) Scan Uses

func (val *TagValue) Scan(src interface{}) error

func (TagValue) Value Uses

func (val TagValue) Value() (driver.Value, error)

type Thumbnail Uses

type Thumbnail struct {
    ArticleID ArticleID `db:"article_id"`
    Thumbnail string
    Link      string
    Processed bool
}

func (Thumbnail) String Uses

func (t Thumbnail) String() string

func (Thumbnail) Validate Uses

func (t Thumbnail) Validate() error

type User Uses

type User struct {
    Login     Login  `json:"login"`
    FirstName string `db:"first_name" json:"firstName"`
    LastName  string `db:"last_name" json:"lastName"`
    Email     string `json:"email"`
    HashType  string `db:"hash_type" json:"-"`
    Admin     bool   `json:"admin"`
    Active    bool   `json:"active"`
    Salt      []byte `json:"-"`
    Hash      []byte `json:"-"`
    MD5API    []byte `db:"md5_api" json:"-"` // "md5(user:pass)"

    ProfileData ProfileData `db:"profile_data" json:"profileData"`
}

User represents a readeef user.

func (User) Authenticate Uses

func (u User) Authenticate(password string, secret []byte) (bool, error)

func (*User) Password Uses

func (u *User) Password(password string, secret []byte) error

func (User) String Uses

func (u User) String() string

func (User) Validate Uses

func (u User) Validate() error

Validate checks whether all required fields have been provided.

type ValidationError Uses

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

Directories

PathSynopsis
extract
monitor
processor
repo
repo/eventable
repo/logging
repo/mock_repoPackage mock_repo is a generated GoMock package.
repo/sql
repo/sql/db
repo/sql/db/base
repo/sql/db/postgres
repo/sql/db/sqlite3
search
thumbnail

Package content imports 16 packages (graph) and is imported by 17 packages. Updated 2019-09-01. Refresh now. Tools for package owners.