sink

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TgBotToken string
	TgChannel  string
}

Config contains params for the sink of the news from rss feeds

func LoadConfig

func LoadConfig(params map[string]string) *Config

LoadConfig returns a new shiny config

func (*Config) HelpLines

func (c *Config) HelpLines() []string

HelpLines returns a string slice with config format help lines

func (*Config) String

func (c *Config) String() string

func (*Config) ValidateParams

func (c *Config) ValidateParams() error

ValidateParams validates params for the config

type Post

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

Post contains a title, a description and a url of a news

func NewPost

func NewPost(title, description, url string, published *time.Time) *Post

NewPost returns a pointer to the newly created Post struct

func (Post) GetPublishableText

func (p Post) GetPublishableText() string

GetPublishableText returns ready for publishing post's text

func (Post) GetPublished

func (p Post) GetPublished() time.Time

GetPublished returns the published time of the post

func (Post) PublishedAfter

func (p Post) PublishedAfter(t time.Time) bool

PublishedAfter returns true if the post was published after the specified time

func (Post) String

func (p Post) String() string

func (Post) YoungerThan

func (p Post) YoungerThan(o Post) bool

YoungerThan returns true if this one post was published before the other one

type Sink

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

Sink publishes posts from feeds

func New

func New(config *Config) *Sink

New constructs a new Sink

func (Sink) Send

func (s Sink) Send(feeds map[string][]Post) uint

Send publishes the post

Jump to

Keyboard shortcuts

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