feed

package
v0.0.0-...-3f65eb9 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnMarshaling = errors.New("feed: json parsing error")
	ErrClient       = errors.New("feed: client connection error")
	ErrReadBody     = errors.New("feed: response payload error")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	URL      string
	Table    string
	Interval int64
}

type Feed

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

type FeedItem

type FeedItem interface{}

type FeedRequester

type FeedRequester interface {
	Request(url string) (*RootFeed, error)
}

type FeedStore

type FeedStore interface {
	// GetPosition retrieve the last position from the db
	GetPosition(table string) uint64
	// SetPosition save the new feed position in the db
	SetPosition(table string, last uint64) error
	// Save the feed in the db
	Save(last interface{}) error
}

FeedStore is the db interface

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Get

func (s *MemoryStore) Get() interface{}

func (*MemoryStore) GetPosition

func (s *MemoryStore) GetPosition(t string) uint64

func (*MemoryStore) Save

func (s *MemoryStore) Save(i interface{}) error

func (*MemoryStore) SetPosition

func (s *MemoryStore) SetPosition(t string, after uint64) error

type PesterRequester

type PesterRequester struct{}

func NewPesterRequester

func NewPesterRequester() *PesterRequester

func (*PesterRequester) Request

func (r *PesterRequester) Request(url string) (*RootFeed, error)

type RootFeed

type RootFeed struct {
	Items []FeedItem `json:"items"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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