stats

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

func NewCollector

func NewCollector(clients []*mastodon.Client, db *sqlx.DB) *Collector

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context, tagNames []string) error

Collect performs a single collection of timeline for the provided tags and imports it to the database configured on the collector. It returns an error returned by the server or nil if successful.

func (*Collector) Report

func (c *Collector) Report(ctx context.Context, tagNames []string) ([]*Status, error)

Report generates a list of posts matching one or more of the provided tagNames. It returns an error if the underlying SQL query fails.

func (*Collector) Start

func (c *Collector) Start(ctx context.Context, tagNames []string)

Start will run this collector in a loop. It will shut down when Stop() is called, or if Collect() function returns an error.

func (*Collector) Stop

func (c *Collector) Stop()

Stop will shutdown the collector, waiting a predetermined time for a graceful shutdown, after which it will return.

type Server

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

func NewServer

func NewServer(ctx context.Context, db *sqlx.DB) *Server

func (*Server) Shutdown

func (s *Server) Shutdown()

func (*Server) Start

func (s *Server) Start()

type Status

type Status struct {
	ID        string         `json:"-"`
	URI       string         `json:"uri" db:"uri" `
	Language  string         `json:"lang" db:"lang"`
	Content   string         `json:"content"`
	TagList   tagList        `json:"tag_list" db:"tag_list"`
	CreatedAt sqliteDatetime `json:"created_at" db:"created_at"`
}

Status is a condensed representation of mastodon.Status

Jump to

Keyboard shortcuts

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