config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFeedServiceFromYML

func NewFeedServiceFromYML(cfgPath string) (*feed.Service, error)

NewFeedServiceFromYML creates a new feed service from a YAML config file.

Types

type FeedConfig

type FeedConfig struct {
	FeedID      string     `yaml:"id"`
	Title       string     `yaml:"title"`
	Description string     `yaml:"description"`
	URL         string     `yaml:"url"`
	Matcher     Matcher    `yaml:"matchers"`
	Functions   []Function `yaml:"functions"`
}

type FeedsConfig

type FeedsConfig []FeedConfig

func ReadFeedsConfigFromYaml

func ReadFeedsConfigFromYaml(cfgPath string) (FeedsConfig, error)

ReadFeedsConfigFromYaml reads a YAML config file and returns a slice of FeedConfig.

type Function

type Function struct {
	Replace *ReplaceFunc
}

type Matcher

type Matcher struct {
	Engine      query.Engine `yaml:"engine"`
	ItemURL     Selector     `yaml:"itemUrl"`
	Title       Selector     `yaml:"title"`
	Description Selector     `yaml:"description"`
	Published   Selector     `yaml:"published"`
}

type ReplaceFunc

type ReplaceFunc struct {
	Field funcs.Field
	From  string
	To    string
}

type Selector

type Selector struct {
	// required fields for GoQuery engine, options for other
	Select string `yaml:"selector"`
	Attr   string `yaml:"attr"`

	// required field for XPath engine, options for other
	Expr string `yaml:"expr"`

	// required field for time props
	Layout string `yaml:"layout"`
}

Jump to

Keyboard shortcuts

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