server

package
v0.0.0-...-fda175b Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(
	r *gin.RouterGroup,
	service *ServerAnalyticsService,
	memoryStore *persist.MemoryStore,
)

Types

type PeriodData

type PeriodData struct {
	Count  int    `json:"count"`
	Period string `json:"period"`
}

type PlayersOnlineRequest

type PlayersOnlineRequest struct {
	ServerId int `json:"server_id"`

	From   time.Time            `json:"date_from" binding:"required"`
	To     time.Time            `json:"date_to" binding:"required"`
	Period analytics.TimePeriod `json:"period" binding:"required"`
}

type PlayersOnlineResponse

type PlayersOnlineResponse struct {
	Items []PeriodData `json:"items"`
}

type PopularServersResponse

type PopularServersResponse struct {
	Items []PopularServersResponseItem `json:"items"`
}

type PopularServersResponseItem

type PopularServersResponseItem struct {
	Id         int    `json:"id"`
	Name       string `json:"name"`
	Difficulty int    `json:"diff"`

	TotalSessions int `json:"total_sessions"`
	TotalUsers    int `json:"total_users"`
}

type ServerAnalyticsService

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

func NewServerAnalyticsService

func NewServerAnalyticsService(db *sql.DB) *ServerAnalyticsService

func (*ServerAnalyticsService) GetCurrentOnline

func (s *ServerAnalyticsService) GetCurrentOnline() (*TotalOnlineResponse, error)

func (*ServerAnalyticsService) GetPlayersOnline

func (s *ServerAnalyticsService) GetPlayersOnline(
	req PlayersOnlineRequest,
) (*[]PeriodData, error)

func (*ServerAnalyticsService) GetPopularServers

func (s *ServerAnalyticsService) GetPopularServers() (*PopularServersResponse, error)

func (*ServerAnalyticsService) GetSessionCount

func (s *ServerAnalyticsService) GetSessionCount(
	req SessionCountRequest,
) (*[]PeriodData, error)

func (*ServerAnalyticsService) GetUsageInMinutes

func (s *ServerAnalyticsService) GetUsageInMinutes(
	req UsageInMinutesRequest,
) (*[]PeriodData, error)

type SessionCountRequest

type SessionCountRequest struct {
	ServerId int `json:"server_id"`

	From   time.Time            `json:"date_from" binding:"required"`
	To     time.Time            `json:"date_to" binding:"required"`
	Period analytics.TimePeriod `json:"period" binding:"required"`
}

type SessionCountResponse

type SessionCountResponse struct {
	Items []PeriodData `json:"items"`
}

type TotalOnlineResponse

type TotalOnlineResponse struct {
	Count int `json:"count"`
}

type UsageInMinutesRequest

type UsageInMinutesRequest struct {
	ServerId int `json:"server_id" binding:"required"`

	From   time.Time            `json:"date_from" binding:"required"`
	To     time.Time            `json:"date_to" binding:"required"`
	Period analytics.TimePeriod `json:"period" binding:"required"`
}

type UsageInMinutesResponse

type UsageInMinutesResponse struct {
	Items []PeriodData `json:"items"`
}

Jump to

Keyboard shortcuts

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