Versions in this module Expand all Collapse all v0 v0.1.0 Feb 14, 2018 Changes in this version + var ErrInvalidSlug = errors.New("store: bad slug format") + var ErrNoResultsFound = errors.New("store: no results found") + func AddHealthCheckEndpoints(r *mux.Router, env *Env) *mux.Router + func AddIndexEndpoints(r *mux.Router, env *Env) *mux.Router + func AddMetricEndpoints(r *mux.Router, env *Env) *mux.Router + func AddSentimentEndpoints(r *mux.Router, env *Env) *mux.Router + func LogRequest(logger log.Logger) func(http.Handler) http.Handler + func RunServer(srv *http.Server) func() error + type Aggregator struct + func NewAggregator(logger log.Logger, db DB) (*Aggregator, error) + func (ag *Aggregator) Run(ctx context.Context, results <-chan *AnalyzerResult) error + type Analyzer struct + func NewAnalyzer(logger log.Logger, client *nl.Client, numWorkers int) (*Analyzer, error) + func (az *Analyzer) Run(ctx context.Context, searched <-chan *SearchResult, ...) error + type AnalyzerResult struct + Magnitude float32 + Score float32 + SearchTerm *SearchTerm + TweetID int64 + type DB interface + GetSentimentByID func(ctx context.Context, id string) (*Sentiment, error) + GetSentimentsBySlug func(ctx context.Context, slug string, limit int) ([]*Sentiment, error) + GetSentimentsByTopic func(ctx context.Context, topic string, limit int) ([]*Sentiment, error) + SaveSentiment func(ctx context.Context, sentiment Sentiment) (string, error) + type Endpoint struct + Env *Env + Handler func(*Env, http.ResponseWriter, *http.Request) error + func (ep *Endpoint) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Env struct + DB DB + Hostname string + Logger log.Logger + type Firestore struct + CollectionName string + Store *firestore.Client + func (fs *Firestore) GetSentimentByID(ctx context.Context, id string) (*Sentiment, error) + func (fs *Firestore) GetSentimentsBySlug(ctx context.Context, topicSlug string, limit int) ([]*Sentiment, error) + func (fs *Firestore) GetSentimentsByTopic(ctx context.Context, topic string, limit int) ([]*Sentiment, error) + func (fs *Firestore) SaveSentiment(ctx context.Context, sentiment Sentiment) (string, error) + type HTTPError struct + Code int + Err error + func (he HTTPError) Error() string + func (he HTTPError) JSON() ([]byte, error) + type SearchResult struct + type SearchTerm struct + Query string + Topic string + type Searcher struct + func NewSearcher(logger log.Logger, terms []*SearchTerm, minResults int, maxAge time.Duration, ...) (*Searcher, error) + func (sr *Searcher) Run(ctx context.Context, searched chan<- *SearchResult) error + type Sentiment struct + Count int64 + FetchedAt time.Time + ID string + LastSeenID int64 + Query string + Score float64 + Slug string + StdDev float64 + Topic string + Variance float64