generator

package
v0.0.0-...-24a8c69 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateRelevance

func CalculateRelevance(
	tweets v1.TweetsResponse,
	timeFrame time.Frame,
	series int,
) (*storage.Relevance, error)

CalculateRelevance calculates relevance.

Types

type Config

type Config struct {
	AllTimeStatistics  bool
	Series             int
	DefaultTimeSpans   time.Durations
	GeneratingInterval time.Duration
}

Config represents a generator configuration.

func (*Config) MarshalLogObject

func (cfg *Config) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*Config) Validate

func (cfg *Config) Validate() error

Validate validates the generator configuration.

type Generator

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

Generator represents a statistics generator.

func New

func New(db storage.Statistical, twtsClient *tweets.Client, config Config, logger *zap.Logger) *Generator

New returns new generator.

func (*Generator) CalculateRelevances

func (gen *Generator) CalculateRelevances(tweets v1.TweetsResponse) (storage.Relevances, error)

CalculateRelevances calculates the relevances for different time spans.

func (*Generator) GenerateRelevances

func (gen *Generator) GenerateRelevances(ctx context.Context)

GenerateRelevances gets all the tweets, generates relevance statistics for all time spans and updates the relevances in the database.

func (*Generator) Start

func (gen *Generator) Start(ctx context.Context)

Start starts the generator.

Jump to

Keyboard shortcuts

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