zero

package
v0.0.0-...-53ebe4d Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPatternInvalid  = "Pattern is invalid Go Regexp pattern"
	ErrPatternInvalidf = fmt.Sprint(ErrPatternInvalid, ", %s")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Global Global
	Items  []Provider
}

Config is the parent RSS feed configuration

It is used to set global and item specific parsing parameters

func NewConfig

func NewConfig(global Global, items []Provider) *Config

NewConfig creates a new instance of the config object

func Setup

func Setup() *Config

Setup creates a new instance of Config and reads in the user's config

func (*Config) ReadRSS

func (c *Config) ReadRSS() Results

ReadRSS reaches out to feed sources and checks for pattern matches

It returns a slice of results that can be parsed for regex pattern matches.

type Global

type Global struct {
	Patterns []string
}

Global is the universal set of configs that are applied to all feeds

type Match

type Match struct {
	Provider *Provider    `json:"provider"`
	Item     *gofeed.Item `json:"item"`
	RawMatch string       `json:"raw_match"`
}

func NewMatch

func NewMatch(provider *Provider, item *gofeed.Item, finding string) Match

func (Match) MarshalEasyJSON

func (v Match) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Match) MarshalJSON

func (v Match) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Match) UnmarshalEasyJSON

func (v *Match) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Match) UnmarshalJSON

func (v *Match) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Matches

type Matches []Match

func (Matches) MarshalEasyJSON

func (v Matches) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Matches) MarshalJSON

func (v Matches) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Matches) UnmarshalEasyJSON

func (v *Matches) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Matches) UnmarshalJSON

func (v *Matches) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Provider

type Provider struct {
	Name    string `json:"name"`
	URL     string `json:"url"`
	Depth   int    `json:"depth"`
	Pattern string `json:"pattern"`
}

Provider is an individual configuration consumed by the RSS parser

func (Provider) MarshalEasyJSON

func (v Provider) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Provider) MarshalJSON

func (v Provider) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Provider) UnmarshalEasyJSON

func (v *Provider) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Provider) UnmarshalJSON

func (v *Provider) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Result

type Result struct {
	ID       string       `json:"id"`
	Provider Provider     `json:"provider"`
	Feed     *gofeed.Feed `json:"feed"`
}

func NewResult

func NewResult(feed Provider, response *gofeed.Feed) Result

func (Result) MarshalEasyJSON

func (v Result) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Result) MarshalJSON

func (v Result) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Result) UnmarshalEasyJSON

func (v *Result) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Result) UnmarshalJSON

func (v *Result) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Results

type Results []Result

func (Results) FindMatches

func (r Results) FindMatches() (Matches, error)

func (Results) List

func (r Results) List() []*gofeed.Feed

func (Results) MarshalEasyJSON

func (v Results) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Results) MarshalJSON

func (v Results) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Results) UnmarshalEasyJSON

func (v *Results) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Results) UnmarshalJSON

func (v *Results) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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