storage

package
v0.0.0-...-e7cb044 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidUser = errors.New("invalid user")

ErrInvalidUser represents invalid user error.

Functions

This section is empty.

Types

type HML

type HML struct {
	High   int64   `json:"high" bson:"high" example:"100"`
	Median float64 `json:"median" bson:"median" example:"50.0"`
	Low    int64   `json:"low" bson:"low" example:"0"`
}

HML represents the high, median and low amount.

func (*HML) MarshalLogObject

func (hml *HML) MarshalLogObject(enc zapcore.ObjectEncoder) error

type Relevance

type Relevance struct {
	TimeSpan string           `json:"time_span" bson:"time_span" example:"10d"`
	Candles  RelevanceCandles `json:"candles" bson:"candles"`
}

Relevance represents relevance candles for a time span.

func (*Relevance) MarshalLogObject

func (rel *Relevance) MarshalLogObject(enc zapcore.ObjectEncoder) error

type RelevanceCandle

type RelevanceCandle struct {
	TimeFrame   string `json:"time_frame" bson:"time_frame" example:"1595700000-1595750000"`
	Favorites   *HML   `json:"favorites" bson:"favorites"`
	Retweets    *HML   `json:"retweets" bson:"retweets"`
	TweetsCount int64  `json:"tweets_count" bson:"tweets_count" example:"100"`
}

RelevanceCandle represents the high, median and low amount of retweets and favorites, and the amount of tweets that make those amounts in a time span.

func NewRelevanceCandle

func NewRelevanceCandle() *RelevanceCandle

NewRelevanceCandle returns relevance candle.

func (RelevanceCandle) MarshalLogObject

func (cdl RelevanceCandle) MarshalLogObject(enc zapcore.ObjectEncoder) error

type RelevanceCandles

type RelevanceCandles []*RelevanceCandle

func (RelevanceCandles) MarshalLogArray

func (cdls RelevanceCandles) MarshalLogArray(enc zapcore.ArrayEncoder) error

type RelevanceOptions

type RelevanceOptions struct {
	TimeSpan *time.Duration
}

RelevanceOptions represents the criteria to get the relevance.

func (RelevanceOptions) MarshalLogObject

func (opts RelevanceOptions) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject marshals relevance options.

type Relevances

type Relevances []*Relevance

Relevances represents relevances in different time spans.

func (Relevances) MarshalLogArray

func (rels Relevances) MarshalLogArray(enc zapcore.ArrayEncoder) error

type Statistical

type Statistical interface {
	Relevance(ctx context.Context, user string, opts RelevanceOptions) (*Relevance, error)
	UpdateRelevances(ctx context.Context, user string, relevances Relevances) error

	Close(ctx context.Context)
}

Statistical represents storage for statistics.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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