config

package
v0.0.0-...-0c73132 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigFileNotGiven Error
	ErrConfigFileNotGiven = errors.New("Config file path not provided")

	// ErrFeedNotFound Error
	ErrFeedNotFound = errors.New("Feed not found")

	// ErrUnknownConfigBackend Error
	ErrUnknownConfigBackend = errors.New("unknown config backend")
)

Functions

This section is empty.

Types

type Config

type Config interface {
	// Authentication management
	SaveUser(user User) error
	GetUser() (User, error)
	// Feed management
	GetFeeds() ([]Feed, error)
	AddFeed(feed Feed) error
	RemoveFeed(url string) error
	// Scrape management
	AddScrapedURL(url string) error
	IsScrapedURL(url string) (bool, error)
	// Close config provider after use
	Close() error
}

Config defines the required methods for a config backend

func GetConfigProvider

func GetConfigProvider() (Config, error)

GetConfigProvider returns the current config provider used for this session. Depends in the cli flags used when calling the program.

func NewFileConfig

func NewFileConfig() (Config, error)

NewFileConfig returns a new config backend based on a file (yaml)

func NewPostgresConfig

func NewPostgresConfig() (Config, error)

NewPostgresConfig creates a new config backend where postgres is used for storage

type Feed

type Feed struct {
	URL  string   `json:"url"`
	Name string   `json:"name"`
	Tags []string `json:"tags"`
}

Feed defines the feed structure stored on disk

func (*Feed) Validate

func (f *Feed) Validate() error

Validate validates the feed content

type User

type User struct {
	ConsumerKey string `json:"consumerKey"`
	Token       string `json:"token"`
}

User stores the user credential used when contacting pocket

Jump to

Keyboard shortcuts

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