commstats

package
v0.0.0-...-cddd04e Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: ISC Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func Repositories

func Repositories() []string

func SetAccounts

func SetAccounts(options config.CommunityStatOptions)

func Subreddits

func Subreddits() []string

func TwitterHandles

func TwitterHandles() []string

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

func YoutubeChannels

func YoutubeChannels() []string

Types

type ChartData

type ChartData struct {
	Date   time.Time `json:"date"`
	Record int64     `json:"record"`
}

type Collector

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

func NewCommStatCollector

func NewCommStatCollector(store DataStore, options *config.CommunityStatOptions) (*Collector, error)

func (*Collector) Run

func (c *Collector) Run(ctx context.Context)

type CommStat

type CommStat struct {
	Date               time.Time         `json:"date"`
	RedditStats        map[string]Reddit `json:"reddit_stats"`
	TwitterFollowers   int               `json:"twitter_followers"`
	YoutubeSubscribers int               `json:"youtube_subscribers"`
	GithubStars        int               `json:"github_stars"`
	GithubFolks        int               `json:"github_folks"`
}

type DataStore

type DataStore interface {
	StoreRedditStat(context.Context, Reddit) error
	LastCommStatEntry() (time time.Time)
	StoreTwitterStat(ctx context.Context, twitter Twitter) error
	StoreYoutubeStat(ctx context.Context, youtube Youtube) error
	StoreGithubStat(ctx context.Context, github Github) error
	LastEntry(ctx context.Context, tableName string, receiver interface{}) error
}

type Github

type Github struct {
	Date       time.Time `json:"date"`
	Stars      int       `json:"stars"`
	Folks      int       `json:"folks"`
	Repository string    `json:"repository"`
}

type Reddit

type Reddit struct {
	Date           time.Time `json:"date"`
	Subscribers    int       `json:"subscribers"`
	AccountsActive int       `json:"active_user_count"`
	Subreddit      string    `json:"subreddit"`
}

type RedditResponse

type RedditResponse struct {
	Kind string `json:"kind"`
	Data Reddit `json:"data"`
}

type Twitter

type Twitter struct {
	Date      time.Time `json:"date"`
	Followers int       `json:"followers"`
	Handle    string    `json:"handle"`
}

type Youtube

type Youtube struct {
	Date        time.Time `json:"date"`
	Subscribers int       `json:"subscribers"`
	Channel     string    `json:"channel"`
	ViewCount   int       `json:"view_count"`
}

Jump to

Keyboard shortcuts

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