siteStats

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller consists instance for a type of data. SiteStat controller consists a slice of utils.Cache which contains data from multiple server

func New

func New() *Controller

New creates a new Controller with its corresponding utils.Cache

func (*Controller) Query

func (c *Controller) Query(query *Query) (results []StageTime, err *errors.Error)

Query queries a set of siteStats response using provided Query

func (*Controller) Server

func (c *Controller) Server(server string) (*utils.Cache, *errors.Error)

Server gives utils.Cache of server

func (*Controller) ServerContent

func (c *Controller) ServerContent(server string) ([]StageTime, *errors.Error)

ServerContent gives matrices from utils.Cache of server

func (*Controller) Status

func (c *Controller) Status(server string) *status.Status

Status gives status.Status of current controller with the status of utils.Cache for server

type Query

type Query struct {
	// Server is the server to query matrix of
	Server string `json:"server,omitempty"`
}

Query describes a query on SiteStat

type RemoteResponse

type RemoteResponse struct {
	TotalStageTimesRecent24H []StageTime `json:"totalStageTimes_24h,omitempty"`
}

type SiteStat

type SiteStat struct {
	Stage       *stage.Stage `json:"stage,omitempty"`
	Item        *item.Item   `json:"item,omitempty"`
	Quantity    int          `json:"quantity"`    // cannot omitempty as it is zeroable
	Times       int          `json:"times"`       // cannot omitempty as it is zeroable
	RecentTimes int          `json:"recentTimes"` // cannot omitempty as it is zeroable
}

SiteStat specifies data structure for the site stats data type

type StageTime

type StageTime struct {
	StageID     string `json:"stageId,omitempty"`
	RecentTimes int    `json:"times"`
}

Jump to

Keyboard shortcuts

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