fetch

package
v0.0.0-...-90bc1be Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LastSevenDays = "7days"
	ThreeMonths   = "3months"
	SixMonths     = "6months"
	TwelveMonths  = "12months"
)

Variables

View Source
var Senders = map[string]bool{
	"cnn":                      true,
	"foxnews.com":              true,
	"foxbusiness.com":          true,
	"nbcnews.com":              true,
	"nbc":                      true,
	"nytimes.com":              true,
	"the new york times":       true,
	"the washington post":      true,
	"wsj.com":                  true,
	"the wall street journal":  true,
	"the wall street journal.": true,
	"politico":                 true,
	"los angeles times":        true,
	"cbs":                      true,
	"abc":                      true,
	"usatoday.com":             true,
	"usa today":                true,
	"yahoo":                    true,
	"ft":                       true,
	"bbc":                      true,
	"npr":                      true,
	"time":                     true,
	"bloomberg.com":            true,
}
View Source
var Timeframes map[string][]time.Time

Functions

func EventRefresh

func EventRefresh(na *mgo.Collection, ne *mgo.Collection, eventTime time.Time, pub pubsub.Publisher) error

func FetchMail

func FetchMail(ctx context.Context, cfg *Config, sess *mgo.Session, apub, epub pubsub.MultiPublisher)

func MapReduce

func MapReduce(sess *mgo.Session) error

func NewNewsAlert

func NewNewsAlert(msg eazye.Email, host, address string) (newshound.NewsAlert, error)

func NewNewsEvent

func NewNewsEvent(id bson.ObjectId, alerts []newshound.NewsAlert, eventTags []string) newshound.NewsEvent

func ReParse

func ReParse(cfg *Config, sess *mgo.Session) error

func ReParseNewsAlert

func ReParseNewsAlert(na newshound.NewsAlert, host, address string) (newshound.NewsAlert, error)

func UpdateEvents

func UpdateEvents(na *mgo.Collection, ne *mgo.Collection, a newshound.NewsAlert, pub pubsub.Publisher) error

Types

type Config

type Config struct {
	DBURL      string `envconfig:"DB_URL"`
	DBUser     string `envconfig:"DB_USER"`
	DBPassword string `envconfig:"DB_PASSWORD"`

	MarkRead bool `envconfig:"MARK_READ"`

	Mailbox eazye.MailboxInfo `envconfig:"MAILBOX"`

	NPHost string `envconfig:"NP_HOST"`
}

func NewConfig

func NewConfig() *Config

func (*Config) MgoSession

func (c *Config) MgoSession() (*mgo.Session, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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